Adruino micro some pins stuck on high

Hi all,

I've just got an arduino micro and am reading the digital input pins. Some of them seem to be stuck on high, is this normal? The code below constantly prints out "pin2" even though nothing is connected to the board.

const int buttonPin = 2;
const int buttonPin2 = 3;

int buttonState = 0;
int buttonState2 = 0;

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(buttonPin2, INPUT);


void loop() {

  buttonState = digitalRead(buttonPin);
  buttonState2 = digitalRead(buttonPin2);

  if(buttonState == HIGH){
  if(buttonState2 == HIGH){


That’s probably because you haven’t attached anything to it. It’s called an open connection and can be anything. To solve this you can use a pull down resistor :.

Or if you want them to be HIGH if nothing is connected, use the build in pull up resistors.

Yes, sorry you're right!