Learn to blast your laser LEDs into space to break up obstacles at the press of a button.
The code below already works and is ready to upload! Upload the code to Code Rocket and see what happens. Then, you'll 'take apart' the code to learn what each piece of the program does.
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!
Can you complete the challenge? Change the code in the editor above, then upload it to your Code Rocket and see if you got the result.
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: Multiple ‘if’ statements
In this program, you see that the code can react to two different inputs (the only two inputs you have on your Code Rocket) and react differently to each of them. Every time the void loop runs, the ‘condition’ of each ‘if’ statement is checked and the ‘action’ is run if the condition is true. If both of the conditions are true, both actions will run on your Code Rocket.