[dorkbotpdx-blabber] Arduino - reading digital pins as a number?
Donald Delmar Davis
ddelmardavis at gmail.com
Thu Jan 1 21:49:38 EST 2009
I am not sure if my initial response answered your questions directly.
1. No unless there is some compelling reason to connect the switches
to vcc go the other way and connect your switches to ground.
2. if you do this then the internal pullups on the port pins will
handle this correctly.
3. given that your pin selection actually spans two io ports then
digital reading the pins is as good as any.
Don.
On Jan 1, 2009, at 3:49 PM, Hans Lindauer wrote:
> A few easy questions for those in the know. I have a DIP (SIP,
> actually) switch connected to pins 5-8 of my dorkboard(s) and to
> +5V, and want to read in the switches as as number.
>
> 1. Can I safely connect +5V to a digital input (or 4), and leave it
> high for an extended period without having to worry about
> overheating or other issues? Probably a dumb question, I know, but
> I'm still learning the ins and out of this stuff.
>
> 2. Do I need pull-down resistors to ground on each of the digital
> pins? I guess I don't understand the necessity of that. Also, is
> my terminology correct?
>
> 3. What's an elegant way to read those pins in as a byte? I know I
> can multiply the pin value by 2^n and add them all up, but it seems
> like there's got to be a smarter way. Maybe I can read a register
> with the pin values and mask off those bits?
>
> Thanks in advance,
> -Hans
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://music.columbia.edu/pipermail/dorkbotpdx-blabber/attachments/20090101/8dd911ac/attachment.html
More information about the dorkbotpdx-blabber
mailing list