Pages: [1]   Go Down
Author Topic: Reading a pushbutton on the analog ins.  (Read 420 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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))
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 203
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: