Pages: [1]   Go Down
Author Topic: Using analog pins with digitalRead  (Read 454 times)
0 Members and 1 Guest are viewing this topic.
Aptos, California
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Can anyone tell me how I can use the analog pins for inputs using the digitalRead and digitalWrite functions. I would like to reassign my buttons to them so I can use an SD card shield that use pins 11, 12, 13. I also want to use the LCD so I have to move 2 of those pins as well

StanK
Logged

Aptos, California
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Can anyone tell me how I can use the analog pins for inputs using the digitalRead and digitalWrite functions. I would like to reassign my buttons to them so I can use an SD card shield that use pins 11, 12, 13. I also want to use the LCD so I have to move 2 of those pins as well

StanK
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17261
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Read the note in the following reference, you can use the pin names A0 to A5 with pinmode, digitalwrite and digitalread commands.

http://arduino.cc/en/Reference/PinMode
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

digitalRead(A0);
digitalRead(14);

Either one works.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26359
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey StanK, don't ask the same question in mulitple places please.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Aptos, California
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks,

I thought it might be that simple. I am new to this environment. I like it. Lot's of helpful people here.

StanK
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25713
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Topics merged.
Don't cross-post - it wastes time.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Aptos, California
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry about double posting. This is my first post and I didn't think I got it in the correct place the first time. I'll be more careful.
I am still finding my way around this web site.

Stan K
Logged

Pages: [1]   Go Up
Jump to: