Read button state issue Arduino Nano evry

Hello,

I've bought an Arduino Nano Evrey and I face some issue when I want to read the state of a push button. That works only on one digital pin (the number 34) and not on the others, so i'm asking myself if the board doesn't work properly or if there is some register to configure.
I know there is intern pull-up, pull-down and maybe I have to play on that but I don't know how and I don't know why that works on only one pin. On some pin by default it seems to be HIGH and others LOW.

Find the schematic here.

Find the pinout schematic:
pinout arduino nano every

Please find the code below (from the example):

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 22; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
Serial.println("PRESSED\n");
delay(200);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
Serial.println("RELEASED\n");
delay(200);
}
}

I'm on Debian and I'm using the IDE 1.8.13

If you can see pins 22 or 34 on that pinout you posted you have much better eyesight than me. So what are you using?

Steve

Hello Steve,

You can see those on the second page of the document :slight_smile:

Try using the D pin numbers. Like are you are for the internal LED (pin D13).

Steve

It works, thank you man
That's confused me all of these numbers, but in one hand that makes sense in other hand it's so confused because how the arduino knows if we use this pin or this one.
For example the led is 13 but it's also the case for the pin 34 wich is called D13 as well. When we look at the arduino uno pinout diagram here so it's easy to know because it's colored in pink.

I agree it's not difficult to get confused. But the IDE (the programming environment) knows about the D and A pin numbers. Stick to those and you'll be o.k.

Steve