Back to Parent

Approach

The tricky part of this exercise is to build a reverse for loop to turn off each pixel one by one.

The initial condition of the reverse loop should be uint16_t i=strip.numPixels()-1, since the maximum number of the pixel should be 15 given the fact that the numbers list from 0 to 15 in the neopixel library.

I only use one function to achieve both loops by adding an indicator showing if the loop inside the function is in ascending or descending order.

Actually, I left one pixel out since if I terminate the reverse loop at i>=o instead of i>0, all the pixels turn off but the loop also terminates. Thus I have to leave one pixel out and directly start the next loop.

The video is attached.


Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0