Assignment #2: Using Loops


In the last assignment, we learned how to create patterns with our blinking LEDs. Notice that a lot of the code repeated itself, but with the pin number that was changing. Let’s modify our last assignment and use loops to decrease the amount of code we have to type.



Create a new sketch called LoopyLoop.ino. This sketch will modify your last assignment’s sketch but we will use loops (for, while, & do…while) to initialize and create your LED patterns.

Remember to keep a copy of the original BlinkMore.ino sketch and try to duplicate the same pattern you created, but use loops instead.



When you are finished your sketch, you will need to hand in the following:

  • Your finished sketch with proper commenting and good programming style
    • Emailed or on a USB key
  • You must use a Push Button in your assignment
  • For creativity points, you can use force sensors, photo resistors or other types sensors in your Arduino project
  • Your report as detailed below



To successfully complete this assignment, you will need to have completed Assignment #1.


Grading Plan

Grades are calculated using the following rubric:

  • Finished sketch compiles without errors and works as described – 40%
  • Use of loops
    • for loop – 10%
    • while loop – 10%
    • do…while loop – 10%
  • Report – 10%
    • Description of your project and what it doesDescribe the loops you used and how you used them
    • Describe the use of push buttons and any other sensors
    • Accurate circuit diagram
  • Good programming style, proper naming conventions and comments – 10%
  • Creative use of your loops (nested loops) – 10%

Total marks possible: 100%


Due Dates: Week of January 25th