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.

Understand interaction logic

Understand interaction logic - Arduino Tutorial

From the course: Arduino: Prototyping

Start my 1-month free trial

Understand interaction logic

- [Instructor] We now have a laser animating across our display and while you probably feel pretty good about getting that to work, truthfully it might get a little boring after a while and the design concept specifies some interaction like zapping some invaders. In this video we'll see how to add invaders and interaction to our prototype. Here's the current pseudocode for the animation. We erase the previous frame, calculate a new laser position, display the laser, delay for a while, and then repeat. The design concept specifies a button for interaction, so we need to update the pseudocode to add checking whether a button is pressed. And if it is, then take some action. So here's some updated pseudocode. We erase the frame just like before, calculate a new laser position, display the laser, but now we check the button. If it's pressed below an invader, then we zap it. Then we go back and delay for a while and then…

Contents