This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a digital input on pin 2 and prints the results to the serial monitor. /* Input Pull-up Serial This example demonstrates the use of ...
Please be aware that I just searched around the web and there may be issues with the hardware setup, but this worked for me, so for you it works probably too.