Hold down a single button to turn on both sirens of Code Car. Release the buttons to turn them off.
The code below already works and is ready to upload! Upload the code to Code Car 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!
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!
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: Growing Your 'if' Statements
This lesson helps you build on the powers of the 'if' statement. If you completed the challenges, you now see that the 'if' statement can be used to combine a number of commands and control multiple outputs with a single button press. As the number of lines in your programs grows, try to keep looking for patterns or 'reversals' of the concepts you're using. For example, the challenge of keeping all of the lights off when the button was pressed has more to do with patterns and code structure than it does with any new code concept.