Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pinMode INPUT_PULLUP does not seem to work #101

Open
marcmerlin opened this issue Apr 19, 2019 · 3 comments
Open

pinMode INPUT_PULLUP does not seem to work #101

marcmerlin opened this issue Apr 19, 2019 · 3 comments

Comments

@marcmerlin
Copy link

marcmerlin commented Apr 19, 2019

I get output to work, I can toggle an LED, but I can't read a switch on port 4, which I can read from python just fine.

Here's the code I used, I see no change when I push the switch. Using a voltmeter it seems that

GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

works in python, but

pinMode(4, INPUT_PULLUP)

does not work in the arduino layer.

Further testing shows that digitalRead does work after that, but I have to add a pull up resistor on my button to make up for the missing one in software (when using the arduino layer)

@marcmerlin marcmerlin changed the title pinMode INPUT does not seem to work pinMode INPUT_PULLUP does not seem to work Apr 19, 2019
@marcmerlin
Copy link
Author

I tested this on rPi 0W and rPi B+

@marcmerlin
Copy link
Author

https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
should be used to check port numbers to fix this

@marcmerlin
Copy link
Author

Page 90 of the PDF says that GPIO defines start at address 0x7E200000 but I can't find that address anywhere in the code:
polgara:/tmp/RasPiArduino$ grep -ri 7E20 .
polgara:/tmp/RasPiArduino$

Similarly, no luck with INPUT_PULLUP:

polgara:/tmp/RasPiArduino$ grep -r INPUT_PULLUP .
./cores/piduino/Arduino.h:#define INPUT_PULLUP    0x10
polgara:/tmp/RasPiArduino$ 

It's a single define that never gets used anywhere :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant