/* Hightechrobo learn by Arian */ #define button 4 #define led 3 void setup() { // put your setup code here, to run once: pinMode(led,OUTPUT); pinMode(button,INPUT_PULLUP); } void loop() { // put your main code here, to run repeatedly: if(digitalRead(button) == 0 and a == 0){ a = 1; while( digitalRead(button) == 0){ analogWrite(led,255); } } else if(digitalRead(button) == 0 and a == 1){ a = 0; while(digitalRead(button) == 0){ analogWrite(led,0); } } }