Let’s fix this problem by using a hardware interrupt. When the Arduino gets to one of the delay() functions, it pauses and can’t do anything else until the delay is over so it misses some of the button presses. But when you press the button, the green LED will turn on sometimes but it misses a lot of the presses. ![]() ![]() If you build this project, you’ll see that the yellow LED blinks on and off just fine. Int buttonState = digitalRead(buttonPin) ![]() Here is the code for the circuit: int buttonPin = 7
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |