LED Circle Cycle

Your circle of LEDs can be used for many things: signals, status indicators, or just cool patterns! Learn how to run them in a circular cycle.

Code

The code below already works and is ready to upload to your Code Rocket! Then take on the challenges and see what changes you can make to create an even cooler project!

Walkthrough Videos

Watch the videos for line-by-line explanation of how the example program works. Then you'll be ready to make some changes of your own!

Challenges

Can you complete the challenges? Change the code in the editor above, then upload it to your Code Rocket and see if you got the result. Don't stop here, keep experimenting with the code!

Concepts

These are the new code concepts covered in this example program. To become a great coder, read through these concepts to learn new vocabulary.

New Concept: New approach, same outcome

You’ve been turning on and off LEDs a bunch of different ways while programming the Code Rocket. In fact, you already had the skills to make a light pattern like this way back with project 3 or 4! In this project, you see a new tool being used- the ‘count with’ loop (called a ‘for’ loop in typed code) - to accomplish a task that would take many lines of code if you just used digitalWrite() and delay() commands to accomplish the same task. And when it came time to add more LEDs, like the challenge prompts you to, you’d be adding lots and lots of lines of code to get there.

Programmers are always looking for ways to use technology to make their code easier to write, run, and understand. As you add more tools to your mental toolbox as a coder, you might want to revisit some of your older programs and see how you could improve them.

Quiz

If you're having trouble, try to run an experimental program or look at the example code to help you find the answer.

1. The 'count with'('for') loop condition that would make the lights reverse direction would be: