Back to Parent

Code Challenge

Our biggest challenge in designing the code was managing the complexity and connectivity of multiple signals. For example:

Handling the Yellow Signal:

When the button is initially pressed to start recording, the Neopixel begins flashing yellow to indicate "recording started." However, this yellow signal needs to stop as soon as the user blows into the wind sensor for the first time and in subsequent breaths to avoid interfering with the user’s interaction. The yellow signal should only reappear when the user releases the button and presses it again to start a new recording session.

Recording Breath Duration:

Implementing the logic for recording the duration of each breath was relatively complex, as it involved storing the duration of every breath in a list and successfully transmitting this data to another device. To achieve this, I introduced a dynamic boolean variable (default: false) to control the start and end of the recording.

When the wind sensor detects a value greater than the predefined threshold for the first time, the boolean is set to true.

While the boolean is true, if the wind intensity falls below the threshold, we can calculate the duration of this breath. The duration is determined by multiplying the reading interval of the wind sensor by the number of readings taken during the breath. This calculated duration is then stored in a corresponding list. Once the breath is complete, the boolean is reset to false, ready for the next breath.

This method allowed us to precisely measure and store each breath duration while ensuring the system resets appropriately for subsequent recordings.


Content Rating

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

0