// © CODE BY SAM TECH PRO // http:///youtube.com/samtechpro // http://Instructables.com/samtechpro const int buttonPin = 10; // the number of the pushbutton pin const int ledPin = 6; // the number of the LED pin int count = 0; // Count the button presses // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); count++; // add 1 to the count if (count >=4) { digitalWrite(ledPin,HIGH); count = 0; } else{ if (digitalRead(ledPin)==HIGH && digitalRead(buttonPin)==HIGH){ digitalWrite(ledPin, LOW); count++; if (count >=4) { count =0; } } } } }