int LED = 2;
int swt = 9;
int active = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LED, OUTPUT);
pinMode(swt, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int x = digitalRead(swt);
Serial.print(x);
delay(100);
}
void x(){
if (digitalRead(swt) == HIGH){
active = !active;
delay(1500);
}
Serial.print(active);
digitalWrite(LED, active);
}