/*
// https://roboticsbackend.com/arduino-input_pullup-pinmode/#Using_an_external_resistor_instead_of_Arduino_INPUT_PULLUP
Add an external pull down resistor, so the default state is LOW.
Add an external pull up resistor, so the default state is HIGH.
Use the Arduino internal pull up resistor. The behavior will be the same as for option no 2.
*/
int pinLed = 13;
int pinSwitch = 2;
int switchStatus;
void setup() {
// put your setup code here, to run once:
pinMode(pinLed, OUTPUT);
pinMode(pinSwitch, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
switchStatus = digitalRead(pinSwitch);
digitalWrite(pinLed, switchStatus);
Serial.println(switchStatus);
delay(500);
}