Unit6 Lesson 12 Step 10

In this activity students turn on the colorLEDs using a For Loop and an array. I believe the array must be named something other than colorLEDs for this to work. I got a type error until I changed the name of the array to something such as “lights”. The instructions in the lab lead you to believe that colorLEDs can be used in the array.

I think the misconception here may be that students don’t need to define a new array at all. The array of color LEDs is named colorLeds (note the capitalization), and it’s already provided for you in the toolbox. If you try to create a new array with the same name, it will override the provided one and you’ll lose access to the color LEDs entirely.


Thanks for the quick response, Josh. Here is a screen capture of the error message. When we renamed the array, it worked.

If you look at the first line, you’ll notice that the colorLeds shows up a colored and uneditable block, which is a clue to students that it’s a name we’re already using for something in the tool. If you named the variable something else it would look like a white editable text box.