dpharris / OlcbRefresh

Refresh of the Arduino base libs
1 stars 3 forks source link

ButtonLed -- work on all processors #1

Open dpharris opened 6 years ago

dpharris commented 6 years ago

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 commented 6 years ago

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.