pull down resistor for arduino code example
Example 1: arduino internal pull up resistor
pinMode(2,INPUT_PULLUP);
Example 2: arduino internal pull up resistor
pinMode(13, OUTPUT);
pinMode(2,INPUT_PULLUP);
pinMode(13, OUTPUT);