We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone! I have written an animation that uses RPi's GPIO pins for interactivity. While this works pretty well on RPi 2, it doesn't work on the RPi 3. I used the exact same code and the same SD card that I used on the RPi 2 and double checked that the pin connections are right. The animation is nothing fancy, just displaying some images depending on some digitalRead() and digitalWrite() (like documented here: https://processing.org/reference/libraries/io/index.html) Can somebody confirm there are issues using RPi 3? Also, some more information: I used Processing 3 for development and Processing is installed on the SD card's OS (Raspbian Jessie full, not light) as well.
Thanks already for any replies, Best wishes, Shu
Answers
@shushustorm I am using the Pi 3 as my main development board, and using the GPIO pins always worked for me. Which particular pins are you having problems with?
You might give our tested Raspbian image with Processing pre-installed a try as well. Please holler if this makes a difference for you.
@gohai Thanks for your reply! That seems odd, though.
I am using the pins 2 and 3: int sensorTrigger = 2; int sensorEcho = 3;
For setting pinMode and accessing them, I use code like that:
GPIO.pinMode(sensorTrigger,GPIO.OUTPUT) GPIO.pinMode(sensorEcho,GPIO.INPUT);
GPIO.digitalWrite(sensorTrigger,1); GPIO.digitalWrite(sensorTrigger,0); GPIO.digitalRead(sensorEcho)
If I understand this correctly, the pin layout is the same on RPi 2 B and RPi 3 B, which I am using. But besides Processing being pre-installed, the Processing version isn't any different, is it? Because I am running the newest Raspbian OS, so it should work fine, right? Unfortunately, I don't really have much time right now to test any differences, so I will use the RPi 2 for the project that I'm working on. I just thought using RPi 3 would increase performance and setting it up would be as easy as putting in the SD card and attaching the pins. Would be great to hear any solutions, though, if somebody knows how to solve this.
@shushustorm GPIO pins 2 and 3 are used for the I2C bus. I haven't attempted to using those myself for GPIO, but I wouldn't be surprised if it won't work.
Try GPIO 4 and GPIO 17 instead. https://pinout.xyz/