Add the following snippet to your HTML:<iframe frameborder='0' height='385' scrolling='no' src='https://www.hackster.io/invisiblebat537/simple-led-light-with-button-press-344458/embed' width='350'></iframe>
When you press a button the LED light will blink as long as you pressed.
Read up about this project on
My dad wanted me to do it so I did it.
const int BUTTON = 2; const int LED = 13; int BUTTONstate = 0; void setup() { pinMode(BUTTON, INPUT); pinMode(LED, OUTPUT); } void loop() { BUTTONstate = digitalRead(BUTTON); if (BUTTONstate == HIGH) { digitalWrite(LED, HIGH); delay(1000); digitalWrite(LED, LOW); delay(1000); } else{ digitalWrite(LED, LOW); } }
Please log in or sign up to comment.
Comments
Please log in or sign up to comment.