how to enable internal pull-up resistor in arduino code example
Example 1: arduino internal pull up resistor
pinMode(2,INPUT_PULLUP);
Example 2: arduino internal pull up resistor
Serial.println(sensorValue, DEC);
pinMode(2,INPUT_PULLUP);
Serial.println(sensorValue, DEC);