My second project is guided by the lab document: https://docs.google.com/document/d/1TIDZUuPiXi0r8-baivgG6vBGhNijcWnoagQ4j97sbVU/edit
Implementing a program that uses the Adafruit Circuit Playground and its library in Arduino IDE to react differently under varying light conditions. When the light is bright, pressing each button would cycle through neopixels, display unique colors, and play corresponding notes (Do, Re, Mi, Fa, Sol, La, Si or C, D, E, F, F, A, and B). When the light is not bright, pressing the right and left buttons will illuminate all neopixels in red and blue, respectively, and play higher-pitched notes.
Build a pseudocode and implement it for light sensing, color setting, tone playing, and button pressing as outlined in the plan.
Upload the program to the Adafruit Circuit Playground. Then, check if the light sensor accurately detects light levels and test in varying light conditions to ensure the program behaves as expected. And, verify that button presses result in the correct sequence of colors and tones.
Define a light value to track the light sensor reading.
Set up: Initialize serial communication at 9600 bps and begin Circuit Playground
Inside the Loop:
Read the light sensor value and assign it to the light value
If the light value is greater than 20 (bright environment):
If the left button is pressed:
For each neopixel from 0 to 9:
Set the neopixel color based on its index
0: Red, 1: Green, 2: Blue, 3: Orange, 4: Yellow, 5: Cyan, 6: Violet, 7:Pink, 8: DeepPink, 9: Burgundy
Play a tone based on the neopixel index
0: C, 1: D, 2: E, 3: F, 4: G, 5: A, 6: B, 7: C (Octave Higher), 8: D (Octave Higher), 9: E (Octave Higher)
Wait for 200 milliseconds and turn off the neopixel
If the right button is pressed:
For each neopixel from 9 to 0 (in reverse order): Set the neopixel color in a reverse order
9: Red, 8: Green, 7: Blue, 6: Orange, 5: Yellow, 4: Cyan, 3: Violet, 2:Pink, 1: DeepPink, 0: Burgundy
Play a tone in reverse order
9: C, 8: D, 7: E, 6: F, 5: G, 4: A, 3: B, 2: C (Octave Higher), 1: D (Octave Higher), 0: E (Octave Higher)
Wait for 200 milliseconds and turn off the neopixel
Otherwise (in dark light):
If the left button is pressed:
For each neopixel from 0 to 9:
Set neopixels to gradually display in purple and play a higher tone based on the neopixel index
Wait for 200 milliseconds and turn the neopixels to blue
All neopixels are in blue in the end.
If the right button is pressed:
For each neopixel from 9 to 0 (reverse order):
Set neopixels to gradually display in purple and play a higher tone in reverse order.
Wait for 200 milliseconds and turn the neopixels red
All neopixels are in red in the end.
Pressing the left button: The second neopixel turns on green with low tune of note D and then off
Pressing the right button: The second neopixel turns on green with low tune of note D and then off
Pressing the left button: Each neopixel is on with purple and higher tune, then switch into blue instead of off. In the end, all neopixels are in blue.
Pressing the right button: Each neopixel is on with purple and higher tune, then switch into red instead of off. In the end, all neopixels are in red.
💁 My Final Version of Circuit Playground Express
💡Importance of the plan-do-evaluate process in building Circuit Playground Express 💡
In the planning phase, I think engaging in an exploration of the Circuit Playground Express's features according to the lab resources was crucial. Understanding how lights and sound inputs work required researching through Adafruit documentation for the Circuit Playground Express, technical guidance associated with color and tone choices, and examples of similar projects. This foundational knowledge was instrumental in formulating a plan that outlined the project's scope.
Evaluating the effectiveness of the initial plan involved testing the paper circuit with the Circuit Playground Express under different light conditions. These tests aimed to assess how well the lights and sound inputs responded to environmental changes, which was critical for the project's success. The evaluation phase highlighted areas where the plan met expectations and where adjustments were necessary. For instance, when the response under varying light conditions was not as anticipated, I revised to code running on the Circuit Playground Express to improve sensitivity or output behavior.
For future projects, I am considering incorporating the usage of a paper circuit and the Circuit Playground Express throughout the planning and execution phases. That would help me explore other functions of the circuit and develop my creativity. All in all, implementing the plan-do-evaluate process will be crucial when working with versatile tools like Circuit Playground Express.