Make Code Car's horn honk a little higher each time you honk it, or create a rising tone 'honk' that turns into a dog whistle!
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: Updating Variables in the Loop
In the last lesson, you learned about replacing a variable for a fixed value, like a pin number. When the program is running, the button that activates the horn probably shouldn't change- that would be some strange code! But in this program, you start to see the value of a variable that can change as the code runs. This makes for much more interactive programs since the program is always updating.
You can refer to a variable that replaces a constant number as a constant variable. A variable whose value changes throughout a program is a non-constant variable.