/// setting up a function to switch on and off
int button = 3;
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
pinMode(button, INPUT);
}
void loop() {
Serial.println(digitalRead(button));
if(digitalRead(button)==HIGH){
digitalWrite(LED_BUILTIN, HIGH);
}
else {
digitalWrite(LED_BUILTIN, LOW);
}
}