Due to sitting for long hours in campus or at home, sometimes I forget that I am slouching and end up feeling a sense of relief when I lie down in bed. Therefore I thought of building something which alerts me if I are slouching. The feedback is aimed to be delivered to a via SMS/ Whatsapp/ other popular messaging application.
Other applications of this can be a mini sound alert system if you are flexing your finger too much after a finger injury, which is not so uncommon among people who play basketball.
The code did not work multiple times. The flex sensor angle kept on changing every time I deployed/ flashed code to the Argon, therefore the bending limits in the code had to be changed multiple times. Sometimes, the argon LED started working, at which point of time I unplugged it and re-ran the code on it.
Here is a code which uses 3 components integrated together. Piezo Buzzer, Flex Sensor and LED. The flex sensor is an analogue pin and provides the input (angle of bending) while the buzzer and the LED are digital pins and provide the output, which is sound and light. The buzzer and light are meant to go off if the flex sensor is bent beyond a certain angle, therefore restricting angle limits have been set.
The code can also be viewed on Github: https://github.com/Harshikerfuffle/Designing_for_IoT/blob/master/flex_peizo_led_part2.ino