///ELECTRONCS MALAYALAM CLAP SWITCH
const int buttonPin = 2;
const int ledPin = 13;
int buttonPushCounter = 0;
int buttonState = 0;
int lastButtonState = 0;
void setup() {
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button went from off to on:
buttonPushCounter++;
Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println(buttonPushCounter);
} else {
Serial.println("off");
}
delay(50);
}
lastButtonState = buttonState;
if (buttonPushCounter % 4 == 0)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
1 Comments
Casino - Dr.MCD
ReplyDeleteWelcome to MDC 나주 출장샵 Gaming, the newest 인천광역 출장샵 gaming provider, with the 울산광역 출장안마 latest games, promotions and payment methods. 안양 출장샵 Get in touch with the casino team, Rating: 4.3 김제 출장샵 · 3,831 reviews