From the course: Arduino: Prototyping
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Solution: Name - Arduino Tutorial
From the course: Arduino: Prototyping
Solution: Name
(upbeat music) - [Instructor] Here's my solution to the challenge. Remember the goal of the challenge is to display a message on the LCD when all of the invaders are zapped. Here's some pseudocode that explains the basic idea. First, create a variable with the number of invaders at the beginning. Then each time through the loop, if the laser's fired by pressing the button, check to see if there's an invader there. If so, subtract from the total invaders and erase the invader from the string variable. Finally, if the number of invaders reaches zero, display a message and halt the sketch. Now let's head to the desktop to see how this works in code. Here we are in the IDE. First thing I'm going to do is I've preloaded retro to our starting point. I'm going to save that as retro to challenge. And now, the first thing I need to do is to the code is, add a variable for the number of invaders. So I'll set that to be an integer…
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.