{"id":17755,"date":"2023-03-14T01:22:42","date_gmt":"2023-03-14T05:22:42","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/?p=17755"},"modified":"2023-03-14T10:04:57","modified_gmt":"2023-03-14T14:04:57","slug":"physical-wake-up-service","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/physical-wake-up-service\/","title":{"rendered":"Physical Wake-up Service"},"content":{"rendered":"<p><strong>Physical Wake-up Service:<\/strong><\/p>\n<p>A very effective alarm clock that gives you an wake-up experience you&#8217;ve never had before.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Images:<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17776\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9095-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p style=\"text-align: center\">Front view of device<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17777\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_9098-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p style=\"text-align: center\">Side view of device<\/p>\n<p>&nbsp;<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-17755-1\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/\u6211\u7684\u5f71\u7247.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/\u6211\u7684\u5f71\u7247.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/\u6211\u7684\u5f71\u7247.mp4<\/a><\/video><\/div>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-17755-2\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/\u6211\u7684\u5f71\u7247-1.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/\u6211\u7684\u5f71\u7247-1.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/\u6211\u7684\u5f71\u7247-1.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Processing<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Key decision point<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17781\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8908-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p style=\"text-align: left\">When I finished working on the servo motor through time control I actually finished the basic work. After that I decided to add buttons to make it easier for the user to operate. I didn&#8217;t intend to include these buttons in my earliest preconceptions, but it would result in the inconvenience of having to upload the set time once every time I set the alarm, which is very inconvenient.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17785\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8914-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p style=\"text-align: left\">I didn&#8217;t want to add an LCD screen in my earliest preconceptions, but eventually I thought it would be a good idea to add an LCD screen to visualize the whole process, after all, as an alarm clock, it would be unreasonable for the user not to be able to see the time directly. But this eventually led me to the assembly of the line gave me a lot of trouble.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Process<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17789\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8807-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p style=\"text-align: left\">As the earliest model, I initially wanted to stick everything on a can of compressed air, but this made the device very awkward to use, so the idea was abandoned.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17790\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8848-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p style=\"text-align: left\">In this image I only decided to stick the servo motor with the canned compressed air. This way the servo motor can directly touch the trigger of the canned air. I used zip ties to keep the servo motor in place on the canned air, and I added a layer of double-sided tape between them to increase friction so the servo motor wouldn&#8217;t move around.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17791\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8910-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p style=\"text-align: left\">This image shows the Real Time Clock, which reads the current time and runs itself internally, so it keeps the correct time after one code upload. So it becomes the most important component.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17812\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/IMG_8909-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p style=\"text-align: left\">This image shows the earliest prototype of the device, which was assembled into a small model, eventually making rewiring the device the most difficult task. And the original small button had to be replaced with a red button, but the red button had poor contact. So I still think the small button is more suitable for this device.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Discussion:<\/strong><\/p>\n<p>First we discussed the comments about the classroom, and as I looked through the comments I found that there were no comments with substantive suggestions. So I thought I would respond to the verbal suggestions that were made at the time. There were two points in total, the first was about the model, the model was not designed very well. The cans of air and servo motor are completely exposed, and it would be better to cover them up to keep the user mystified. And the tube used to extend the distance of air injection needs to be fixed in a better way. I couldn&#8217;t agree more with these two points, first of all the first point was not envisioned when I designed the model and I think it makes perfect sense. This is really a design flaw that I need to improve. But the second point is also something I had thought about, in my opinion I need a tube that is closer to the material of the water pipe, since this material is soft enough and can be extended while fixing a certain shape.<\/p>\n<p>Going back to my own opinion about my project, I think I am very satisfied with my project, but the result is not 100% satisfying to me. One of the main reasons is that when I should use the red buttons, I can&#8217;t set the alarm time accurately with these buttons. The link to it is very unstable due to the soldering. I tried to use smaller buttons but they could not be firmly fixed on the model. So it would be a great success if I could solve this problem. The next point of dissatisfaction is the model, I think the model design has many defects. In addition to not covering the canned air well as mentioned before, I think I designed the model too delicate, which gave me a lot of trouble when lining up the wires. All the wires were messed up which made me struggle a lot during assembly, so a bigger model was necessary. In addition, I also need to design an extra socket on the model to connect the Arduino to the computer, so that it is more convenient to upload.<\/p>\n<p>Through the process of working on this project, I realized that I need to be more attentive in designing models. I don&#8217;t think I&#8217;m incapable of doing this well, I just think I need more time and more common sense. So I think this project is a very good attempt. Next time I will consider the wiring first and the aesthetics second. Also if I could give my previous self a suggestion, I would tell him that.<\/p>\n<p>In the follow-up I hope to have the opportunity to continue building another iteration of this project. First I will solve the model problem, I will make the model bigger to make the wiring easier, and make the appearance more user-friendly. After that I will figure out how to solve the button problem, I hope there is a better way or I can find a suitable button to solve the poor contact problem. When the two problems are solved I believe the device can really be put into use.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Technical Information:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-17874\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2.jpg\" alt=\"\" width=\"1193\" height=\"2022\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2.jpg 1193w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2-177x300.jpg 177w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2-604x1024.jpg 604w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2-768x1302.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2-906x1536.jpg 906w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2-973x1649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/03\/Project-2-508x861.jpg 508w\" sizes=\"(max-width: 1193px) 100vw, 1193px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Code<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/*\r\nProject Name: Physical Wake-up Service\r\nMade by Yuxi(Ethan) Xu\r\n\r\n- LCD screen display real time and set alarms\r\n- use button to set alarms\r\n- servo motor will be activated when the set time is reached\r\n- servo motor presses the trigger of can of compressed air\r\n\r\nPin Mapping:\r\n3: Servo motor\r\n4-7: Button Power In 1-4\r\n12: Switch Power In\r\n\r\nSome of the code is adapted from the following sources\r\n- DS3231 RTC (Real Time Clock) Interfacing with Arduino to build DIY Digital Clock, Author: Harshil Patel\r\n- ArduinoGetStarted.com: Arduino - Switch\r\n*\/\r\n\r\n#include &lt;RTClib.h&gt;\r\n#include &lt;Wire.h&gt;\r\n#include &lt;Servo.h&gt;\r\n#include &lt;ezButton.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n\r\nLiquidCrystal_I2C screen(0X27, 16, 2);\r\nezButton toggleSwitch(12);\r\nRTC_DS3231 rtc;\r\n\r\n\/\/Servo motor\r\nconst int SERVOPIN = 3;\r\nServo Servo1;\r\n\r\n\/\/Buttons\r\nconst int buttonPin1 = 4;\r\nconst int buttonPin2 = 5;\r\nconst int buttonPin3 = 6;\r\nconst int buttonPin4 = 7;\r\nint PbuttonState1;\r\nint PbuttonState2;\r\nint PbuttonState3;\r\nint PbuttonState4;\r\nint buttonState1;\r\nint buttonState2;\r\nint buttonState3;\r\nint buttonState4;\r\n\r\n\/\/Alarm clock\r\nint alarmhr;\r\nint alarmmin;\r\nint h;\r\nint m;\r\nchar t[32];\r\n\r\nvoid setup() {\r\n  Serial.begin(9600);\r\n  Wire.begin();\r\n  rtc.begin();\r\n  Servo1.attach(SERVOPIN);\r\n  toggleSwitch.setDebounceTime(50);\r\n\r\n  pinMode(buttonPin1, INPUT);\r\n  pinMode(buttonPin2, INPUT);\r\n  pinMode(buttonPin3, INPUT);\r\n  pinMode(buttonPin4, INPUT);\r\n\r\n  rtc.adjust(DateTime(F(__DATE__),F(__TIME__))); \/\/adjust Real Time Clock to current time (You can delete it after uploading it once)\r\n\r\n  screen.init();\r\n  screen.backlight();\r\n}\r\n\r\nvoid loop() {\r\n\r\n  \/\/Real Time Clock setup:\r\n  DateTime now = rtc.now();\r\n  sprintf(t, \"%02d:%02d:%02d %02d\/%02d\/%02d\", now.hour(), now.minute(), now.second(), now.day(), now.month(), now.year());  \r\n  h=now.hour();\r\n  m=now.minute();\r\n\r\n  \/\/Switch setup:\r\n  toggleSwitch.loop();\r\n  if (toggleSwitch.isPressed()){\r\n    Serial.println(\"The switch: OFF -&gt; ON\");\r\n  }\r\n  if (toggleSwitch.isReleased()){\r\n    Serial.println(\"The switch: ON -&gt; OFF\");\r\n  }\r\n  int state = toggleSwitch.getState();\r\n\r\n  \/\/LCD setup:\r\n  if (state == LOW){\r\n    Serial.print(F(\"Date\/Time: \"));\r\n    Serial.println(t);\r\n\r\n    \/\/Print \"Time\/Date: \" and Real Time Clock on LCD\r\n    screen.home();\r\n    screen.print(F(\"Time\/Date: \"));\r\n    screen.setCursor(0, 1);\r\n    screen.print(t);\r\n  }\r\n  else{\r\n    \/\/Print \"SetAlarmHr\/Min: \" and \"SetAlarmHr\/Min: \" on LCD\r\n    Serial.print(\"SetAlarmHr\/Min: \");\r\n    screen.home();\r\n    screen.print(\"SetAlarmHr\/Min: \");\r\n\r\n    \/\/Button setup:\r\n    PbuttonState1 = buttonState1;\r\n    PbuttonState2 = buttonState2;\r\n    PbuttonState3 = buttonState3;\r\n    PbuttonState4 = buttonState4;\r\n\r\n    \/\/Read state of button\r\n    buttonState1 = digitalRead(buttonPin1);\r\n    buttonState2 = digitalRead(buttonPin2);\r\n    buttonState3 = digitalRead(buttonPin3);\r\n    buttonState4 = digitalRead(buttonPin4);\r\n\r\n    \/\/Set hours and minutes when pressed button\r\n    if(buttonState1 == HIGH &amp;&amp; PbuttonState1 == LOW){\r\n      alarmhr += 1;\r\n    }\r\n    if(buttonState2 == HIGH &amp;&amp; PbuttonState2 == LOW){\r\n      alarmhr += 10;\r\n    }\r\n    if(buttonState3 == HIGH &amp;&amp; PbuttonState3 == LOW){\r\n      alarmmin += 1;\r\n    }\r\n    if(buttonState4 == HIGH &amp;&amp; PbuttonState4 == LOW){\r\n      alarmmin += 10;\r\n    }\r\n\r\n\/\/Print set alarm time\r\nscreen.clear();\r\n    Serial.println(alarmhr);\r\n    Serial.println(alarmmin);\r\n    screen.setCursor(0, 1);\r\n    screen.print(alarmhr);\r\n    screen.setCursor(3, 1);\r\n    screen.print(alarmmin);\r\n    \r\n    \/\/Servo motor works according to the time set by the alarm clock\r\n    if((h==alarmhr) &amp;&amp; (m==alarmmin)) {\r\n      Servo1.write(175);\r\n      delay(300);\r\n      Servo1.write(90);\r\n      delay(300);\r\n    }\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Physical Wake-up Service: A very effective alarm clock that gives you an wake-up experience you&#8217;ve never had before. &nbsp; Images: Front view of device Side view of device&#8230;<\/p>\n","protected":false},"author":45,"featured_media":17776,"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\/s2023\/work\/wp-json\/wp\/v2\/posts\/17755"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/comments?post=17755"}],"version-history":[{"count":5,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/posts\/17755\/revisions"}],"predecessor-version":[{"id":17880,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/posts\/17755\/revisions\/17880"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/media\/17776"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/media?parent=17755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/categories?post=17755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/tags?post=17755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}