Int var = map (potReading, potMax, potMin, 1, 4)
Proposed Plan:
Case 1:
Range 1- consistent red
Case 2:
Range 2- consistent blue
Case 3:
Range 3- red and blue slow alteration
Case 4:
Range 4- red and blue fast alteration
https://www.arduino.cc/en/Tutorial/SwitchCase was used to be familiarized with the format of code. I initially found that there were not 4 distinct cases being shown, case 1 and 2 just seemed like they stayed on all the time. I adjusted my code so the potentiometer value range was smaller, starting from 200 (arbitrary number greater than 90). I still can’t get the potentiometer to read correctly every time though.
Code, pictures, video and documentation (full) are in the drive:
https://drive.google.com/drive/folders/0B6vucT1cFrpgMTBkLUFkZXFPWWs?usp=sharing
In this project, I had lots of syntax problems, besides that the servo didn’t work for the first several tries. Besides that, the delay in the program was a bit too long for the first time and sometimes it doesn’t register the button push. However, in one mode, the button register too fast, creating other problems.
https://drive.google.com/a/andrew.cmu.edu/file/d/0ByluH07JIf_MT1JpUkRDcUw2ems/view?usp=sharing
]]>I had quite a bit of trouble getting the counter to work with a for loop, and ended up using a workaround with several if statements to do the counting of the button presses. The switch cases were relatively straightforward after I figured that out.
If I were to add something to this, I would make each of the switch cases display something more interesting than simply a counter or a random pattern. Perhaps I could set each case to display the count in binary, doing so using a sequence instead of hard coding it like I did here.
link to zip: https://drive.google.com/open?id=0B_rqoxuDYou6ZlJCeHFHWHNjdnc
]]>I had the most trouble getting the switches to give me reliable information. I had to set my lever switches’s pin mode to INPUT_PULLUP to get it to give me the values that I wanted. There is some flickering on the LED screen due to the lever switch that persists but that is hard to control because I’m using a lever switch as an on off button. I tried using a momentary switch instead but it made less sense to me so I switched back to a lever switch
Link to code and documentation: https://drive.google.com/drive/folders/0B3_nRvY5FHyHQ0lldkQ5QUVKdjg?usp=sharing
]]>The google drive contains my process, project and reflection.
https://drive.google.com/drive/u/3/folders/0BxP5AAHGNXBAbmR2dG5tRnVJWG8
In doing this project, I was stuck for a long time because no matter what I did the photoresistor and PIR sensor were always reading high values. I tried different values of resistors for “pull-down” and nothing was seeming to work. On getting a second pair of eyes on the circuit, I found that the lead that was meant to be connected to ground was actually connected to a different pin. This was a big lesson: when something is not working, check the simplest parts of the circuit. It is easy to not connect leads in the pin you were not intending to. I also learnt that it is important to tune sensors like the PIR sensor and photoresistor to the surroundings you expect to be working in. For example, a PIR sensor will work differently in the dark as it will in daylight.
If I were to work on this further, I would want to really fine tune my sensor parameters. I would also prototype the actual wearable and see if it is a feasible design. I would also want to make the code more robust and make sure it works for all cases. I want to create some sort of input, maybe a potentiometer, for the photoresistor threshold such that the person can pick when they want this device turned on.
Link to drive (pictures and code): https://drive.google.com/file/d/0Bz7Or4Zn580Cb0VHNVdYNzJ5cWc/view?usp=sharing
Link to YouTube: https://youtu.be/EC0nI5keNt0
Drive Link: https://drive.google.com/drive/folders/0B70fyRiHk85qWUtYcjNxUFlTYk0
]]>youtube video link- https://youtu.be/lUm5E2ytEoQ
link to code- https://drive.google.com/drive/folders/0B_JEXda9ZXwvem9yRks3LUlrcXM?usp=sharing