{"id":14214,"date":"2021-11-02T08:15:53","date_gmt":"2021-11-02T12:15:53","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/?p=14214"},"modified":"2021-11-02T08:17:03","modified_gmt":"2021-11-02T12:17:03","slug":"medicine-taking-reminder","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/medicine-taking-reminder\/","title":{"rendered":"Medicine Taking Reminder"},"content":{"rendered":"<div id=\"attachment_14218\" style=\"width: 1686px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14218\" loading=\"lazy\" class=\"wp-image-14218 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894.jpeg\" alt=\"\" width=\"1676\" height=\"1625\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894.jpeg 1676w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894-300x291.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894-1024x993.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894-768x745.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894-1536x1489.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894-973x943.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8426-scaled-e1635713112894-508x493.jpeg 508w\" sizes=\"(max-width: 1676px) 100vw, 1676px\" \/><p id=\"caption-attachment-14218\" class=\"wp-caption-text\">Final Project Full Image<\/p><\/div>\n<div id=\"attachment_14219\" style=\"width: 1696px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14219\" loading=\"lazy\" class=\"wp-image-14219 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861.jpeg\" alt=\"\" width=\"1686\" height=\"1191\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861.jpeg 1686w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861-300x212.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861-1024x723.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861-768x543.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861-1536x1085.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861-973x687.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8427-scaled-e1635723105861-508x359.jpeg 508w\" sizes=\"(max-width: 1686px) 100vw, 1686px\" \/><p id=\"caption-attachment-14219\" class=\"wp-caption-text\">Final Project Full Image 2<\/p><\/div>\n<div id=\"attachment_14470\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14470\" loading=\"lazy\" class=\"size-full wp-image-14470\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8475-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-14470\" class=\"wp-caption-text\">Project with medicine bottles for size<\/p><\/div>\n<div style=\"width: 360px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-14214-1\" width=\"360\" height=\"640\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/demo-project-2.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/demo-project-2.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/demo-project-2.mp4<\/a><\/video><\/div>\n<h2>Overview<\/h2>\n<p>This project is meant to remind you on an interval to take your medication, but also let you know whether or not you have taken medication already to avoid double dosing. I often have a problem where I will forget whether or not I have already taken medication and in order to avoid double dosing, I will just not take medication that time. However, this absolutely leads to me to miss doses, and this project was meant to solve this issue.<\/p>\n<h2>Process Images and Review<\/h2>\n<p>The first design decision that I worked through was how to register the presence of the medication bottles within each container. My initial idea was to use a round force sensitive resistor to detect the bottles. As I designed and built this for my prototype, I realized that there were serious flaws with this idea, the first being the need for some way to concentrate the weight of the bottle onto the resistor. My solution, as shown in the image of my prototype, was to add a mushroom looking platform that sits on a small cylinder the size of the FSR. However, this was very finicky and unstable and inconsistent in registering presence.<\/p>\n<div id=\"attachment_14215\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14215\" loading=\"lazy\" class=\"size-full wp-image-14215\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-scaled.jpeg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-scaled.jpeg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8312-508x381.jpeg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-14215\" class=\"wp-caption-text\">The top circle cutout shows what the FSR looks like, and the lower image shows the platform sitting on top of the FSR. This was the prototype before I made the design decision.<\/p><\/div>\n<div id=\"attachment_14440\" style=\"width: 1245px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14440\" loading=\"lazy\" class=\"wp-image-14440 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303.jpg\" alt=\"\" width=\"1235\" height=\"1011\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303.jpg 1235w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303-300x246.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303-1024x838.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303-768x629.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303-973x797.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8470-scaled-e1635851560303-508x416.jpg 508w\" sizes=\"(max-width: 1235px) 100vw, 1235px\" \/><p id=\"caption-attachment-14440\" class=\"wp-caption-text\">Close up of the platform<\/p><\/div>\n<div id=\"attachment_14441\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14441\" loading=\"lazy\" class=\"size-full wp-image-14441\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/IMG_8469-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-14441\" class=\"wp-caption-text\">Platform sitting within a medicine holder<\/p><\/div>\n<p>I decided to change this setup to take advantage of the small IR distance sensors that use photo-resistors to register distance. This was far more accurate and solved any inconsistency issues I had.<\/p>\n<p>Another updated design decision that I made regarding this device, is the change from 4 holes to 2 holes for medication. Given the cables required for sensors, LEDs, the joystick, and the LCD display, space became quite limited within the box itself. 4 was an unfeasible number of medication slots for the device to have, it would not have been possible unless I designed the entire device as a cube.<\/p>\n<h2>Discussion<\/h2>\n<p>One comment that I received during the peer feedback was &#8220;<span style=\"font-weight: 400\">Joystick has many functions that simplify user interface&#8221; and I completely agree. My original idea was to use 5 different buttons for up\/down\/left\/right\/click actions, but realized that the Joystick is a single object that allows for all of those movements. This meant that I can in the future add as many user settings as possible, and use L\/R to scroll between the settings and U\/D to change the settings, and click to confirm or reset the device time.<\/span><\/p>\n<p>Another comment that I received was &#8220;<span style=\"font-weight: 400\">The light source could be a bit brighter, since it is a bit muted right now because of the opaque 3d printing material in the way.&#8221; and in hindsight, this would have been great to take into consideration. My problem with displaying whether medication had been taken was that finding a place to put the LED so that it is visible was difficult. What this comment touches on, is why do I not create a clear container to hold the medication, and perhaps use an opaque wall to separate the container from other containers and the internal components. This would have been a much prettier and more effective design.<\/span><\/p>\n<p>Overall, I am fairly happy with where the project ended up, but there were absolutely improvements that would have made the end product better. My goal with this project was to learn to laser cut and design using CAD software, learn to 3D print, and create a viable method of reminding myself to take medication. Laser cutting and 3D printing was a step of the creation process that I spent a lot of time on and think that I am far more comfortable with now. While this is a viable way to remind myself to take medication, my peers were correct when saying that a simple 7 day physical container for medication would have been much simpler. That is one of the flaws of the project as a whole, in that it was completely unnecessary but a lot of fun to create.<\/p>\n<p>While working on this project, I definitely learned that laser cutting and 3D printing is not quite the scary monster that I had always considered it. For some reason, I had always considered these two things intimidating and psyched myself out of learning both skills. This project and the number of iterations I needed to make on my project gave me comfort with cutting with the Rabbit machines. I also learned that while in the past I was very good at just jamming wires into wherever it would fit, when trying to work with a box and size constraint, proper wire management is important and is something that I should look into planning for future projects. During this project I realized that creating pieces and parts that fit well with each other is surprisingly soothing and therapeutic, and on the other hand frustrating when they do not fit together, and I can definitely see myself coming to make small trinkets to give my brain a breather.<\/p>\n<p>I do not expect to build another iteration of this project, like mentioned above, because this project is very redundant in its functionality. There is a far simpler alternative that would fulfill the same purpose far more reliably. If I were to remake it, I would change the material used to 3D print to a clear material, turn the box into acrylic for the aesthetic, and include proper wire management into size planning and the internal layout.<\/p>\n<h2>Technical Information<\/h2>\n<div id=\"attachment_14464\" style=\"width: 1021px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14464\" loading=\"lazy\" class=\"wp-image-14464 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-e1635854270125.jpg\" alt=\"\" width=\"1011\" height=\"544\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-e1635854270125.jpg 1011w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-e1635854270125-300x161.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-e1635854270125-768x413.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-e1635854270125-973x524.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-e1635854270125-508x273.jpg 508w\" sizes=\"(max-width: 1011px) 100vw, 1011px\" \/><p id=\"caption-attachment-14464\" class=\"wp-caption-text\">Block Diagram<\/p><\/div>\n<div id=\"attachment_14465\" style=\"width: 1314px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-14465\" loading=\"lazy\" class=\"wp-image-14465 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690.jpg\" alt=\"\" width=\"1304\" height=\"1056\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690.jpg 1304w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690-300x243.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690-1024x829.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690-768x622.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690-973x788.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/11\/Project-2-Ideation-1-e1635854331690-508x411.jpg 508w\" sizes=\"(max-width: 1304px) 100vw, 1304px\" \/><p id=\"caption-attachment-14465\" class=\"wp-caption-text\">Schematic<\/p><\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n\r\n\/* \r\nProject Name: Medicine Taking Reminder\r\nNathan Shao\r\nDescription: This code powers the settings and timer functionality of the Medicine Taking Reminder Box. It allows a user to switch \r\n             settings by moving a joystick left and right, and modifying that setting using up and down, and resetting the timer\r\n             by pressing down on the joystick.\r\nCredit: Some pieces of code were taken from the 60-223 course website at https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/tutorials\/I2C-lcd\r\n\r\n*\/\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\n\r\nint VRx = A0;\r\nint VRy = A1;\r\nint SW = 2;\r\n\r\nint photoresist1Pin = A2;\r\nint LED1 = 13;\r\nint photoresist2Pin = A3;\r\nint LED2 = 12;\r\n\r\nint xPosition = 0;\r\nint yPosition = 0;\r\nint SW_state = 0;\r\nint mapX = 0;\r\nint mapY = 0;\r\n\r\nlong def = 43200000; \/\/ 12 hours\r\n\r\nlong timer1 = 0;\r\nbool read1 = false;\r\n\r\nlong timer2 = 0;\r\nbool read2 = false;\r\n\r\nint curSetting = 0;\r\nlong adjust = 0;\r\nlong settingTimer = 0;\r\nlong curTime = 0;\r\nlong medTime1 = def;\r\nbool taken1 = false;\r\nlong medTime2 = def;\r\nbool taken2 = false;\r\n\r\nvoid setup() {\r\n  \/\/ initialize the screen (only need to do this once)\r\n  screen.init();\r\n\r\n  \/\/ turn on the backlight to start\r\n  screen.backlight();\r\n\r\n  \/\/ set cursor to home position, i.e. the upper left corner\r\n  screen.home();\r\n  \/\/ print the words Hello, world! onto the screen starting at the above cursor position\r\n  screen.print(\"Hello, world!\");\r\n  screen.clear();\r\n\r\n  Serial.begin(9600);\r\n\r\n  pinMode(VRx, INPUT);\r\n  pinMode(VRy, INPUT);\r\n  pinMode(SW, INPUT_PULLUP);\r\n\r\n  pinMode(photoresist1Pin, INPUT);\r\n  pinMode(LED1, OUTPUT);\r\n  pinMode(photoresist2Pin, INPUT);\r\n  pinMode(LED2, OUTPUT);\r\n\r\n  curTime = millis();\r\n}\r\n\r\n\/\/ read the joystick\r\nvoid readJoy() {\r\n  xPosition = analogRead(VRx);\r\n  yPosition = analogRead(VRy);\r\n  SW_state = digitalRead(SW);\r\n  mapX = map(xPosition, 0, 1023, -512, 512);\r\n  mapY = map(yPosition, 0, 1023, -512, 512);\r\n}\r\n\r\nvoid processDisplay() {\r\n  if (mapX &gt; 300 &amp;&amp; (millis() - settingTimer &gt; 1000)) {\r\n    \/\/ If the joystick moves left or right, change the setting currently selected\r\n    curSetting = (curSetting + 1) % 2;\r\n    settingTimer = millis();\r\n  }\r\n  else if (mapX &lt; -300 &amp;&amp; (millis() - settingTimer &gt; 1000)) {\r\n    curSetting = (curSetting + 1) % 2;\r\n    settingTimer = millis();\r\n  }\r\n  \/\/ output updated selection and time to LCD\r\n  screen.clear();\r\n  screen.print(\"Med 1:\");\r\n  screen.print(medTime1 \/ 1000 \/ 60 \/ 60);\r\n  screen.print(\" hours\");\r\n  if (curSetting == 0) {\r\n    screen.print(\"*\");\r\n  }\r\n  screen.setCursor(0, 1);\r\n  screen.print(\"Med 2:\");\r\n  screen.print(medTime2 \/ 1000 \/ 60 \/ 60);\r\n  screen.print(\" hours\");\r\n  if (curSetting == 1) {\r\n    screen.print(\"*\");\r\n  }\r\n\r\n  \/\/ If the joystick moves up or down, modify the selected setting by an hour each\r\n  switch (curSetting) {\r\n    case 0:\r\n      if (mapY &gt; 300 &amp;&amp; (millis() - adjust &gt; 500)) {\r\n        medTime1 -= 3600000;\r\n        adjust = millis();\r\n      }\r\n      else if (mapY &lt; -300 &amp;&amp; (millis() - adjust &gt; 500)) {\r\n        medTime1 += 3600000;\r\n        adjust = millis();\r\n      }\r\n      break;\r\n     case 1:\r\n       if (mapY &gt; 300 &amp;&amp; (millis() - adjust &gt; 500)) {\r\n          medTime2 -= 3600000;\r\n          adjust = millis();\r\n        }\r\n        else if (mapY &lt; -300 &amp;&amp; (millis() - adjust &gt; 500)) {\r\n          medTime2 += 3600000;\r\n          adjust = millis();\r\n        }\r\n      break;\r\n     default:\r\n      break;\r\n  }\r\n}\r\n\r\n\/\/ read the first IR sensor\r\nvoid readIR1() {\r\n  int readVal;\r\n  readVal = analogRead(photoresist1Pin);\r\n  if (readVal &lt; 100 &amp;&amp; !read1) {\r\n    timer1 = millis() + 2000;\r\n    read1 = true;\r\n  }\r\n  Serial.print(readVal);\r\n}\r\n\r\n\/\/ read the second IR sensor\r\nvoid readIR2() {\r\n  int readVal;\r\n  readVal = analogRead(photoresist2Pin);\r\n  if (readVal &lt; 100 &amp;&amp; !read2) {\r\n    timer2 = millis() + 2000;\r\n    read2 = true;\r\n  }\r\n  Serial.print(\" \");\r\n  Serial.println(readVal);\r\n}\r\n\r\n\r\nvoid loop() {\r\n  readJoy();\r\n  \/\/ if button press, reset the time\r\n  if (SW_state == 0) {\r\n    curTime = millis();\r\n    taken1 = false;\r\n    digitalWrite(LED1, LOW);\r\n    digitalWrite(LED2, LOW);\r\n  }\r\n\r\n  processDisplay();\r\n\r\n  readIR1();\r\n  \/\/ update LED state as necessary\r\n  if (millis() &gt; timer1 &amp;&amp; read1) {\r\n    digitalWrite(LED1, HIGH);\r\n    read1 = false;\r\n  }\r\n\r\n  readIR2();\r\n  \/\/ update LED state as necessary\r\n  if (millis() &gt; timer2 &amp;&amp; read2) {\r\n    digitalWrite(LED2, HIGH);\r\n    read2 = false;\r\n  }\r\n\r\n  \/\/ when time limit reached, reset LEDS.\r\n  if (millis() &gt; curTime + medTime1 &amp;&amp; !taken1) {\r\n    digitalWrite(LED1, LOW);\r\n    digitalWrite(LED2, LOW);\r\n    taken1 = true;\r\n    curTime = millis();\r\n  }\r\n  \/\/ when time limit reached, reset LEDS.\r\n  if (millis() &gt; curTime + medTime2 &amp;&amp; taken1) {\r\n    digitalWrite(LED1, LOW);\r\n    digitalWrite(LED2, LOW);\r\n    curTime = millis();\r\n    taken1 = false;\r\n  }\r\n\r\n  delay(100);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview This project is meant to remind you on an interval to take your medication, but also let you know whether or not you have taken medication already&#8230;<\/p>\n","protected":false},"author":202,"featured_media":14218,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[89],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/14214"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/users\/202"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/comments?post=14214"}],"version-history":[{"count":8,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/14214\/revisions"}],"predecessor-version":[{"id":14475,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/14214\/revisions\/14475"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/media\/14218"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/media?parent=14214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/categories?post=14214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/tags?post=14214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}