(Exercise) Code Homework no.04
Instructions
Make sure that you upload each code example to the respective area in the spreadsheet. Create a separate .py for each exercise. Please make the files are named clearly, they need at least, your name, the #, and the exercise number so something like “SantiagoBenjamin__WU01__E01.py” would be something I might name my files, but you’re not obligated to use this exact syntax.
Make sure that each of your code examples has comments!
Questions
- Define a function that does the following:
- Lights up all the neopixels one color
- waits a fixed amount of time
- turns all the neopixels off
- waits a fixed amount of time
Call the function in the main loop.
- Define a function that does the following:
- selects a single neopixel and makes it "glow" white (r,g, and b go from 0 - 255, then 255-0)
- make the function so the neopixel selected is determined when it is called (for example glow_a_pixel(0))
- call the function in your main loop, but use random.randint() to select a random neopixel
- Do the following:
- Define a function with any name you'd like.
- Make it light up all the neopixels a single color in a sequence (you have some liberty with how you do this)
- Make the color a parameter that can change when the function is called
- Call the function with one color (your choice) when the Circuit Playground is tapped
- Call the function with another color (your choice) when the Circuit Playground is shaken