arduino internal pull up resistor
snippet in c

arduino internal pull up resistor

user1495

pinMode(2,INPUT_PULLUP);

arduino digital io pins

user2449

void setup() {
  pinMode(13, OUTPUT);    // sets the digital pin 13 as output
}

void loop() {
  digitalWrite(13, HIGH); // sets the digital pin 13 on
  delay(1000);            // waits for a second
  digitalWrite(13, LOW);  // sets the digital pin 13 off
  delay(1000);            // waits for a second
}

arduino internal pull up resistor

user816

pinMode(13, OUTPUT);

arduino internal pull up resistor

user7655

Serial.begin(9600);

arduino internal pull up resistor

user9586

int sensorValue = digitalRead(2);

arduino internal pull up resistor

user6995

Serial.println(sensorValue, DEC);