U6 L12 LED on/off

csd-unit-6
#1

23%20PM

This code turns LED’s on but repeating it for the Off button with the changes needed doesn’t turn them off and I keep getting this message ERROR: Line: 6: TypeError: Cannot read property ‘on’ of undefined.

I know that we move on to the .length command after this but it seems like var i should work too.

Thanks!

#2

There are only 10 colorLeds. Change the condition for both for loops to use i< 10 instead of i<11. The index runs from 0-9 for the 10 colorLeds.

2 Likes
#3

Thanks! For some reason I thought it had to be 1 more than the actual # of LEDs