Back to Parent

Outcome


Skill Dev II: Working with Inputs & Sensors

Project Summary:

In this project, my goal was to build a system using a flex sensor and LEDs, where the flex sensor's bend degree controls the lighting behavior. I then added a push button switch to alter the interaction between the flex sensor and the LEDs -- allowing the LEDs to respond differently when the button is pressed or not. 

In each below exercise, the process and outcome are explained. 

Flex Sensor & Two LEDs (Video Below):

In this setup, the flex sensor is connected to the analog pin A0 on the breadboard to measure bend pressure, while two LEDs are connected to digital pins Red (D3) and Orange (D2), acting as visual indicators. The code reads the flex sensor's value, mapping its bend to defined thresholds to determine LED behavior: a medium bend triggers the red LED, and a high bend activates both LEDs.   

Show Advanced Options

Flex Sensor, Push Button Switch, & Two LEDs (Video/Code Below):

In this setup, I added a push button switch to the breadboard, connected to digital pin D4. This is alongside the existing flex sensor and two LEDs. With adding the push button, the code now can operate in more than one method. For example, when the button is not pressed, the flex sensor's bend dictates LED behavior, lighting up the red LED for medium bends and both LEDs for high bends (as shown in the previous example). However, when the button is pressed – the LEDs blink quickly ten times for high bends, and blink slowly three times in an alternating fashion for medium bends. 

Show Advanced Options
Show Advanced Options

Next Steps:

One of the items that I would like to try that I did not get to was trying to see how I could potentially get two different sensors to work with one another. I would have liked to see if I could create a multi-sensor criteria where after more than one parameter was met then that would create a different output, maybe not on a LED light this time. 

Reflection:

One of the primary obstacles I encountered was understanding why I needed create the flexValue variable as that seemed like a gap in my understanding until I figured it out. After I figured this out, it became easier to understand how I would make this variable <>=, to the various flex sensor bend thresholds that I was creating. To add, the bend thresholds were a little tricky to dial in. To little or to much would allow it to be to easily triggered or not at all. If the interval between the two bend pressure measurements were not set wide enough either then you couldn't make it distinct enough between to two readings that I was trying to create. 

Drop files here or click to select

You can upload files of up to 20MB using this form.