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

ButtonLed -- work on all processors #1

Open
dpharris opened this issue Dec 22, 2017 · 1 comment
Open

ButtonLed -- work on all processors #1

dpharris opened this issue Dec 22, 2017 · 1 comment

Comments

@dpharris
Copy link
Owner

I am not sure ButtonLed will work on all processors because it uses:
pinMode(pin, INPUT); // .. change the pin to input..
digitalWrite(pin, HIGH); // .. and activate pull up
and not all processor activate pull-up this way.

@dpharris
Copy link
Owner Author

dpharris commented Dec 22, 2017

Looks like newer IDEs, see: https://www.arduino.cc/en/Tutorial/DigitalPins
use:
pinMode(pin, INPUT_PULLUP);
and at keast Energia and Teensy allow:
pinMode(pin, INPUT_PULLDOWN);

Use code:
if(sense) pinMode(pin, INPUT_PULLDOWN);
else pinMode(pin, INPUT_PULLUP);
instead of:
pinMode(pin, INPUT); // .. change the pin to input..
digitalWrite(pin, HIGH); // .. and activate pull up

BUT INPUT_PULLDOWN is NOT defined on all processors.

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