// found here: https://arduino.stackexchange.com/questions/3479/how-to-toggle-led-on-button-press // First version is by Joey, I modified it and changed the code by adding a different blinking rythm. int ledPin = 7; // This is the pin of the ATtiny44 connected to the REDled int buttonPin = 3; // This is the pin of the ATtiny44 connected to the button int buttonState = 0; void setup() { // Here I setup the pins and tell them what their 'state' is. pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT_PULLUP); } void loop(){ // This gets the current state of the button buttonState = digitalRead(buttonPin); // This checks if there is a difference in the button state, did I push it? if so than it will blink on and of with a delay of 50. if (buttonState == LOW) { // Switch the state of the output digitalWrite(ledPin, HIGH); delay (50); digitalWrite(ledPin, LOW); delay (50); digitalWrite(ledPin, HIGH); delay(50); } else { digitalWrite(ledPin, HIGH); // If the button is not pressed the RED light is on. } }