Create separate buttons for each siren light so that you can control how they toggle on and 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: A Pattern of Statements
This lesson takes one step up from your previous 'if-else' statements, and it definitely contains the most curly braces so far! If you showed this program to someone who had never seen code before, they'd be amazed (and maybe confused). You should be seeing the patterns in the programs at this point and understanding that, although there are lots of syntax marks, line breaks, and strangely typed words in the code, you're really looking at a simple 'if' statement, repeated twice. If you played around with the challenges and the code, you probably saw that the 'if' statements aren't related to each other; that is, you can delete one 'if-else' statement and the code still works. Continue trying to see the patterns in a program when you first look through it. You might even notice that you can skim over some of the details of the example code at this point and quickly get the 'general idea' of the program just by looking at it.