From the course: Arduino: Prototyping
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Advanced button interaction - Arduino Tutorial
From the course: Arduino: Prototyping
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.