FANDOM


The PICO-8 builds for Raspberry Pi and PocketChip include support for reading and writing to the GPIO pins on those devices (added in v0.1.9). You can also use the GPIO interface from read/write to JavaScript in web exports of PICO-8 carts (added in v0.1.7).

APIEdit

To access the GPIO pins, peek or poke to bytes

0x5f80..0x5fff

in memory. PICO-8 will automatically set a pin to read mode when you peek the memory address or write mode when you poke to the address.

In the web exports, you may use arbitrary bytes in these memory locations to be read from and written to by JavaScript code.

In the hardware implementations, the GPIO pins act digitally, with 0 representing 0 and 255 representing 1. Also, hardware implementations may not support all 128 pins. Raspberry Pi, for instance, reportedly only supports the first 8 pins.

Raspberry Pi SetupEdit

Raspberry Pi B+Edit

On a Raspberry Pi B+ model, no additional setup was necessary (using v0.1.10). Run the pico8 binary via

sudo ./pico8

to enable access to the GPIO pins. If you do not use sudo to run PICO-8, the program will crash with a WiringPi error when your cart tries to access the GPIO memory space.

Raspberry Pi 2 and newer modelsEdit

One newer Raspberry Pi models, the version of WiringPi included in the statically-linked pico8 binary. Instead, you will have to build and install SDL 2.0.5 from source as well as a more recent version of WiringPi. Then, use the pico8_dyn binary to run PICO-8.

Older modelsEdit

On older models of the Raspberry Pi than the B+ model, GPIO may not work at all with PICO-8.

PocketChip SetupEdit

TODO: document experience using PocketChip with PICO-8. Example: I think we had to install a newer (unofficial?) version of PICO-8 using the Debian package manager.