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!
New Concept: Imagining and Visualizing
As your code gets more complex, it may be helpful to find ways to visualize what you want to do before putting into coding terms. In the final challenge of this example program, you might want to write down "4 on, wait, 5 on, wait, 6 on, wait....." and so on, before 'translating' your idea into the code terms "digitalWrite()" and "delay". Especially as you're getting used to the syntax of coding, take some time to visualize and imagine how you want your code to work before you start typing.
New Concept: Breaking it Down
You learned in the last project to look for patterns in existing code. In this program, you may have created your own patterns, starting with figuring out how to turn on and off one LED light. Maybe you used the 'copy/paste' commands on your keyboard or maybe you typed out each line of code. In either case, it will help you become a better programmer if you try to think about the repeating actions and patterns you want your code to run. Once you build the first piece, all you have to do it copy it and make small changes, like the pin number of an LED light.
HOC : Step by step
To complete the challenges in this lesson, you'll have to carefully think through the logical sequence of steps the code must take in order to turn on and off the LED lights. It might be helpful to have a pencil and paper to write down the sequence of your steps before translating it into code. Remember to look for patterns that you can repeat!
QuizIf you're having trouble, try to run an experimental program or look at the example code to help you find the answer.
When you have a coding challenge that you're not sure how to complete, a good first step might be to ____________________ . Hint: there is more than one right answer!
The void loop of this program only contains 2 different functions. Which of these is not included in the void loop?