Atmega328p A6 and A7 not working

Hi I have a problem my Atmega328p A6 and A7 pins are not working i have a large project for wich i need all analog inputs but if i try to read analog input A6 or A7 i get an error: "A6 was not declared in scope".

Thanks in advance for any help.

This is just a very simple version to test the analog pin A6 to show you i havent done anything wrong in the code.

int x = 0;
const int pin = A6;

void setup() {
  Serial.begin(9600);

  pinMode(pin, INPUT);
}

void loop() {
  x = analogRead(pin);
  Serial.println(x);

}

What have you got the board set to in the IDE ?

1 Like

What Arduino board do you have and what did you connect to the relevant pin?

Bare chip on breadboard? Use the MiniCore boards package.

The UNO will not support that, the Nano will. You need to be sure the proper board is selected in tools. If yours is not there contact the manufacturer or retailer for the appropriated module for your IDE. You could try a Nano, there are two bootloaders and I will guess it will be the old one that will work.

Thanks for the fast answers.
Sorry i did not say i have a Arduino Nano CH340C.
I have set the IDE to Atmel Atmega328p Xplained mini

Set the board to plain "Arduino Nano"

1 Like

Your code compiles fine for me with the board set to Arduino Nano.

Okay i have set it to Arduino Nano and now it is compiling fine.
But when uploading i get an error that says this:

Sketch uses 1870 bytes (6%) of program storage space. Maximum is 30720 bytes.
Global variables use 188 bytes (9%) of dynamic memory, leaving 1860 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x8e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x8e
Failed uploading: uploading error: exit status 1

Look in the options for the Nano. There's old bootloader and new bootloader. Pick the other one from the one that's picked now.

1 Like

Perfect its working.
Thanks didn´t know that :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.