From the course: Arduino: Prototyping

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Advanced button interaction

Advanced button interaction - Arduino Tutorial

From the course: Arduino: Prototyping

Start my 1-month free trial

Advanced button interaction

- [Instructor] If you've been playing around with your prototype, you might have noticed that while the button is responsive, sometimes you zap two invaders with a single button press. In fact, you may have discovered the cheat that you can destroy all the invaders by just holding the button down while the laser moves. Let's take a minute to talk a bit more about buttons. Then we'll see how we can improve the laser situation. Buttons are pretty natural. You press them, and you release them. And in a sketch you can read the value from the connected Arduino pin to determine if the button is up or down. But sometimes up and down aren't quite enough. You may want to toggle a light on and off but only when the button is pressed. In other words, when the button does from up to down. But you don't want to continue toggling the light while the button is down. That's the situation with our laser. The same may apply to a button…

Contents