Go Down

Topic: Reading a pushbutton on the analog ins. (Read 475 times) previous topic - next topic

jlulian38

The title does pretty much explain my problem.

All of my digital pins are taken up powering (an admittedly trivial) set of LEDs, and I want to be sure I can do this before I order a bunch of parts (I'm really crazy about not buying stuff I'm not gonna use, I this this might be my main tinkererering problem (I also have a severe parentheses overuse problem))

jims

Should work. Use a pull-up resistor, say 10k, and let the switch pull it down. You can read it as an analog value and decide if it is a large or a small number.

I think at the hardware level there is nothing stopping you from just using those pins as digital inputs, but you couldn't use digitalRead() on them. You'd have to read the port and check the proper bit.

jlulian38

Ah, thanks. I'm not much of an electrical engineer (or tinkererer or such). I'm usually playing around in the magical land of computering.

Go Up