int ledPin = 13;
int swPin = 8;
boolean X0 = LOW;
boolean X1 = HIGH;
boolean flagg = LOW;
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);
pinMode(swPin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
X1=digitalRead(swPin);
if ((X0 == LOW) && (X1==HIGH)) {
flagg = !flagg;
}
X0=X1;
digitalWrite(ledPin, flagg);
}
No comments:
Post a Comment