LED Circle Button Cycle

Combine your knowledge of variables, statements, and loops to create a light pattern on the LED circle of Code Rocket!

Code

The code in the editor below already works. Just plug in your Code Rocket and press upload to see what it does! Tinker with it and make changes to see what each line of code controls. 

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

How many can you complete? Change the code according to the challenges below. Upload your code to see the effect when you're finished. Complete a challenge? Check it off the list!

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: Conditions, conditions

When your program’s action is based on a condition as simple as ‘pressCount’, you can see how you can quickly build a complex program with very few inputs. This project is similar to the ‘Space Headlights’ project, but it takes the idea further about how many pressCounts you can have. When your button input increases the value of a variable, there’s almost no limit to how many different outcomes you could have. You could even have a special number of presses that triggers a ‘secret’ reaction.

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. What will happen if you limited pressCount to 5 instead of 4?