Go Down

Topic: HELP : ATMega328P_AU - Using A6 & A7 as DIGITAL pins (Read 64 times) previous topic - next topic

mcnobby

with regard to ATMEGA328P_AU...

Has anyone had any success in using analog pins A6 and A7 as DIGITAL pins ??

I dont have anymore pins I could use and need these as digital inputs and I have my miserable face on !

Ta, Bob :(
while (z--) { snoreEvenLouder(); }
www.smartshow.lighting - www.dmx512.lighting

LarryD

I am not sure but, i thought i read some where here these cannot be used as digital pins.
The way you have it in your schematic isn't the same as how you have it wired up!

CrossRoads

A6, A7 are analog input only. One can read and react to them as if digital inputs tho:
Code: [Select]

if (analogRead(A7) >= 613){
// HIGH Input for ~3V (of 5V)
}
else {
// LOW INPUT for everything else; not really ideal as LOW is <0.9V
}
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

mcnobby

Cheers Larry and Bob, just as I thought, its a shame that I have to waste time doing and analog read though

Thanks for the snippet of Code Bob, I shall do something like that, unless I can swap something else around, trouble is I am using these pins for reading switch inputs so they will be read pretty frequently

Does anyone know how long it takes to do an analog read ?

Cheers, Bob
while (z--) { snoreEvenLouder(); }
www.smartshow.lighting - www.dmx512.lighting

LarryD

A quick check reveals 100 readings takes about 11308uS.
On a UNO 16MHZ board.
The way you have it in your schematic isn't the same as how you have it wired up!

mcnobby

A quick check reveals 100 readings takes about 11308uS.
On a UNO 16MHZ board.
Jeez, thats like FOREVER !! lol
while (z--) { snoreEvenLouder(); }
www.smartshow.lighting - www.dmx512.lighting

Go Up