Hiya! Took me a little while to figure out how to read from a GPIO pin on a PocketCHIP, so thought I'd put my example code here in case anybody else comes looking for the same thing I was. It's not actually very complicated, but maybe the code and the notes will save someone some time.
This example uses GPIO 6 - to use a different pin, just change the pin value accordingly e.g. GPIO 5 would be 0x5f86.
Pico-8 reads hardware pins as digital, so you're not going to get a value from them other than 0 or 255. In this example I've called these two values "on" and "off".
You might need to run Pico-8 as root by opening Terminal from the PocketCHIP home screen and typing "sudo pico8".
This example won't do anything in browser.
[Please log in to post a comment]