From the course: Arduino: Prototyping
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Solution: Modify the animation - Arduino Tutorial
From the course: Arduino: Prototyping
Solution: Modify the animation
(upbeat instrumental music) - [Instructor] Here's the solution I came up with for this challenge. Remember, this challenge has two goals. First, in our current prototype, the laser animation goes in a single direction from left to right. The goal is to make the laser bounce back and forth in both directions. The second goal is to experiment with different animation speeds and observe the results. Currently, our prototype moves the laser by adding one to the laser column each time through the loop. When the laser goes past the right side of the LCD, the laser column is reset to zero. To make the laser bounce, you can start by using a variable instead of a constant one for calculating the laser animation step. Then, when the laser reaches the right side of the LCD, you can change the laser step to minus one. When it reaches the left side, the laser step changes to one again and so on. You can see the If statements here.…
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.