Log In  

how do i access gpio and how does it work like is 0x5f85 the 5th pin or the 6th pin how the heck do i count in decimals why is there a face on my wal-

(i don't actually own a pi i'm just trying to code for one)

P#137029 2023-11-06 19:22 ( Edited 2023-11-07 09:59)

the situation is a little messy!
let’s look at this nice site: https://pinout.xyz/pinout/wiringpi

the top-left pin is the first pin a human will see, its role is 3v3 power, and it does not have other number or name

the pin under it is physically the third pin, it does not have a specific role (that what «general purpose input-output» means: they could be used to connect to lights, buttons, etc), it’s called gpio 2, and the once very popular library wiringpi calls it pin 8, so pico-8 will call it 8 too

for another example, the pins documented here https://pinout.xyz/pinout/i2c can be used for the i²c communication protocol to connect to other components; in this mode, specific pins have specific roles and must be connected accordingly (so they’re not general-purpose there)

the docs tell us «0x5f80..0x5f9f mapped to wiringPi pins 0..31», so 0x5f80 (or 24448 if you prefer, hex notation is just more usual and shorter but both mean the same number) + 8 will give you the memory address to read or write that pin (0x5f88)

from the docs: https://www.lexaloffle.com/dl/docs/pico-8_manual.html#GPIO

P#137077 2023-11-07 15:43 ( Edited 2023-11-07 17:43)

[Please log in to post a comment]