Check out example codes for "arduino internal pull up resistor". It will help you in understanding the concepts better.

Code Example 1

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
}

Code Example 2

Serial.begin(9600);

Code Example 3

Serial.println(sensorValue, DEC);

Code Example 4

int sensorValue = digitalRead(2);

Code Example 5

pinMode(13, OUTPUT);

Code Example 6

pinMode(2,INPUT_PULLUP);

Learn ReactJs, React Native from akashmittal.com