hi.
it seems impossible to use the A6 and A7 pins as digital input. reading their analog values works fine but when setting pinMode(A6,INPUT_PULLUP);
pinMode(A7,INPUT_PULLUP);
(also tried external pullups)
nothing gets returned when using
Serial.print(digitalRead(A6));
Serial.print(" , ");
Serial.println(digitalRead(A6));
i have tried this with the most recent arduino pro mini 3.3v and 5v version.
pins A4 and A5 work fine as expected.
am i doing something wrong?
thanks, stephan.
Have you read this: http://arduino.cc/en/Tutorial/AnalogInputPins
Especially the part:
The Atmega datasheet also cautions against switching analog pins in close temporal proximity to making A/D readings (analogRead) on other analog pins. This can cause electrical noise and introduce jitter in the analog system. It may be desirable, after manipulating analog pins (in digital mode), to add a short delay before using analogRead() to read other analog pins.
Can you post your entire non-working code? In code tags please.
pin A4 and A5 output 0 or 1 depending if you connect them to GND or not
pin A6 and A7 never react at all.
void setup(){
Serial.begin(9600);
pinMode(A4,INPUT_PULLUP);
pinMode(A5,INPUT_PULLUP);
pinMode(A6,INPUT_PULLUP);
pinMode(A7,INPUT_PULLUP);
}
void loop(){
Serial.print(digitalRead(A4));
Serial.print(" , ");
Serial.print(digitalRead(A5));
Serial.print(" , ");
Serial.print(digitalRead(A6));
Serial.print(" , ");
Serial.println(digitalRead(A7));
}
@ the OP :
Is there any chance you didn’t select the correct board (a Pro Mini) as the target/board in the IDE ? I note that an Uno only has 6 analog inputs so an A6 and an A7 would be unknown in it’s environment.
A6 and A7 on the Pro Mini are analog only, they can’t support digital functions.
Dan
unfortunately i did select the right board. arduino pro or pro mini (5v,16mhz) atmega 328
@dkulinski i guess that’s what i am learning right now.
i will have to implement analog read with some threshold value to emulate on/off reading states.
thanks.
dkulinski:
A6 and A7 on the Pro Mini are analog only, they can’t support digital functions.
Dan
From the datasheet (pg4) ...
http://www.atmel.com/Images/doc8161.pdf
1.1.9 ADC7:6 (TQFP and QFN/MLF Package Only)[/b]
In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter.
These pins are powered from the analog supply and serve as 10-bit ADC channels.
So there’s the answer. Not all 328P’s are created equal.