If I have an external signal connected to a GPIO pin, what’s the best way to have a “when the pin goes high” hunk of scratch code? I found this: http://www.raspberrypi.org/learning/reaction-game/ which suggests that ScratchGPIO uses the physical pin numbers but when we tried reading those we didn’t see what we expected. A statement that compared the pin to 1 always executed, even if the pin was grounded.
First thing to do is run ScratchGPIO and then look to see what sensor pins show up on the second last sensing block
You should see a load of pins – pin10,pin19,pin21 etc
All those pins are set as inputs (with a software pull up resistor so that they read 1 normally)
If you ground one of those pins, the sensor value should change to 0
Pins 11,12,13,15,16 and 18 are set as outputs so they don’t appear in the list
If you are using ScratchGPIO plus – then no pin is set to any state so,for instamce, you’ll need to say
to configure pin8 for input with a software pull-up resistor