I spent much of this week stuck in an internet video and tutorial worm hole getting more lost than I was to begin with. I found myself finally grasping the concepts from last week, while drowning in connecting code to hardware. However, with some office hours time and good old fashioned trial and error, the pieces started to come together.
Before getting lost in code, I started by successfully completely both labs.
I decided to embark on a project with analog input and digital output using the flex sensor. I was originally going to make a stress ball that when squeezed, the smiley face would light up. With some inspiration from office hours, I decided to go forward by making a frown, and when the stress ball is squeezed, it turns into a smile.
I had some failure initially with the code.
The biggest challenge I faced was getting the output to follow suit with the analog input. After some trial and error, I realized that the problem was in the range of the sensor. I kept reading the println, adjusting and finally I mapped the range to 0, 255, which is how I got the desired result.
This was the successful test. But how will it perform in real life?
I did my first soldering. And after that I encountered even more issues with the flex sensor and its range. It appears as though the soldering altered its properties a bit. Possibly.
I re-read, readjusted and instead of giving a range in the code:
if (sensor <= 50 || sensor >= 80)
I changed it to just be:
if (sensor >= 80)
ITP got you down? Not sleeping? Having nightmares about java script coding?
NOT TO WORRY! StresSmile is here!
Squeeze the the stress ball and turn that frown into one big smile!
(Fine Print: Stress Face does not give you any extra time to do your work. May cause internal temporary happy thoughts. Only good for analog input/digital output assignment. Not covered by student loans. Computer power not included. )