int button = 3; //pinout of the attiny44 int led = 8; //pinout of the attiny44 int pushButton=0; // button's state int state=0; //0=led off, 1=led on int pushButtonPrev=0; // previous button's state void setup() { pinMode(button, INPUT); pinMode(led, OUTPUT); } void loop() { pushButton = digitalRead(button); // read if the button is pushed if ((pushButton==HIGH)&&(pushButtonPrev==LOW)){ state=1-state; } pushButtonPrev=pushButton; // update the new button's state if (state==1){ digitalWrite(led, HIGH); //turn on the led } else { digitalWrite(led, LOW); //turn off the led } }