pull up resistor arduino uno code example
Example 1: arduino internal pull up resistor
pinMode(2,INPUT_PULLUP);
Example 2: arduino internal pull up resistor
Serial.begin(9600);
pinMode(2,INPUT_PULLUP);
Serial.begin(9600);