Go Down

Topic: Reading a pushbutton on the analog ins. (Read 458 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
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview