{"id":16427,"date":"2022-10-26T22:47:33","date_gmt":"2022-10-27T02:47:33","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/?p=16427"},"modified":"2022-10-26T22:47:33","modified_gmt":"2022-10-27T02:47:33","slug":"study-buddy","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/study-buddy\/","title":{"rendered":"Study Buddy"},"content":{"rendered":"<p style=\"text-align: left\">By: Jonathan Lindstrom<\/p>\n<h2>What is it?<\/h2>\n<p>The Study Buddy helps keeps you focused while studying and gives you a sweet reward after intense study sessions.<\/p>\n<h2>Discussion<\/h2>\n<p>For my project, I feel many things went well but there was also a lot that could be improved upon. Starting with the positive critiques I was happy to hear that \u201cThe interface was excellent. Super intuitive to use. And so well contained in the box!\u201d That was one of my primary focuses in my project. I wanted to create an interface that anybody could pick up and be able to navigate. Creating the UI was my favorite part of the project. Working with it I learned a lot about what makes an effective UI. In the future, I think I would code it a little differently to save some memory on the Arduino but overall I was very proud of it.<\/p>\n<p>For negative critiques many of the comments regarded the LED indicator, my classmates mentioned \u201cI should possibly add more LEDs to signify if the user was in work time or break time, or having multiple colors of LEDs to make the design a bit more intuitive. \u201c I agree and it is something that I wish I had properly implemented. I was planning to have different colors for work and break but I simply ran out of time and it wasn\u2019t a priority for me.<\/p>\n<p>There were a couple of things I wish I had done differently or better. I wish I had implemented the different colored LEDs as I feel it would have made the light indicator more effective. I also would have liked to integrate the candy dispensing mechanism into the main body of the project as opposed to building it on the side.<\/p>\n<p>I do not think I will build a second iteration but these would be the next steps if I were to build a second interaction of this project. Furthermore, when I performed some user tests I realized that the fact that a joystick is a button isn\u2019t necessarily intuitive. I had users attempting to press the home button to select options in my menu. This led me to glue on little signs near my buttons to make it more intuitive but if there were a second iteration I would laser cut these messages.<\/p>\n<p>Overall I was pleased with how my project turned out. It functions largely how I intended it to and I had a lot of fun designing the UI and laser cutting the housing for the electronics.<\/p>\n<h2>Images &amp; Videos<\/h2>\n<h4>-Final Image<\/h4>\n<div id=\"attachment_16435\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16435\" loading=\"lazy\" class=\"wp-image-16435 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0013-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16435\" class=\"wp-caption-text\">The final images of my Study Buddy.<\/p><\/div>\n<h4>-Working Video<\/h4>\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-16427-1\" width=\"620\" height=\"1102\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_4138.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_4138.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_4138.mp4<\/a><\/video><\/div>\n<p>Note: Demo time in this video is sped up to 10x speed so the full functionality can be shown.<\/p>\n<h4>-Detail Photos<\/h4>\n<div id=\"attachment_16480\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16480\" loading=\"lazy\" class=\"size-full wp-image-16480\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0039-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16480\" class=\"wp-caption-text\">The LED on the top of the box serves two functions. Firstly it is an indicator that the device should be on and working and it also blinks when the user has paused their study time or when it is transitioning between work and break time.<\/p><\/div>\n<div id=\"attachment_16482\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16482\" loading=\"lazy\" class=\"size-full wp-image-16482\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0045-1-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16482\" class=\"wp-caption-text\">The joystick is used to navigate the user interface. The code is constantly checking the position of the joystick as well as when it is pressed so it can perform the functions the user desires.<\/p><\/div>\n<div id=\"attachment_16469\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16469\" loading=\"lazy\" class=\"wp-image-16469 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0047-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16469\" class=\"wp-caption-text\">Candy Dispenser built out of a servo and cardboard. It is attached to the body using hot glue and balsa wood and the servo wires are fed in through a small hole.<\/p><\/div>\n<h4>-Use Photos<\/h4>\n<div id=\"attachment_16471\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16471\" loading=\"lazy\" class=\"wp-image-16471 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0042-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16471\" class=\"wp-caption-text\">The screen for changing values. Can scroll up or down to increase\/decrease the total time spent studying. There are the same screens for work time and break time.<\/p><\/div>\n<div id=\"attachment_16473\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16473\" loading=\"lazy\" class=\"wp-image-16473 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0044-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16473\" class=\"wp-caption-text\">The screen for studying. Counts you down and alternates between your work and break times until the total time is done.<\/p><\/div>\n<div id=\"attachment_16468\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16468\" loading=\"lazy\" class=\"wp-image-16468 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1711\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-300x201.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-1024x684.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-768x513.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-1536x1027.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-2048x1369.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-973x650.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/DSC_0049-508x340.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-16468\" class=\"wp-caption-text\">Once you are done the screen displays &#8220;Great Study Session!&#8221; and dispenses the candy.<\/p><\/div>\n<h2>Process Images and Review<\/h2>\n<h4>-Process Images<\/h4>\n<div class=\"mceTemp\"><\/div>\n<div id=\"attachment_16501\" style=\"width: 1820px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16501\" loading=\"lazy\" class=\"size-full wp-image-16501\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201.jpg\" alt=\"\" width=\"1810\" height=\"973\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201.jpg 1810w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201-300x161.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201-1024x550.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201-768x413.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201-1536x826.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201-973x523.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/IMG_0201-508x273.jpg 508w\" sizes=\"(max-width: 1810px) 100vw, 1810px\" \/><p id=\"caption-attachment-16501\" class=\"wp-caption-text\">These were some of the first drawings of how I wanted the UI to look. Some changes were made as I went but you can see how these influenced the interface in the study buddy.<\/p><\/div>\n<div id=\"attachment_16448\" style=\"width: 917px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16448\" loading=\"lazy\" class=\"wp-image-16448\" style=\"font-size: 16px\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM.png\" alt=\"\" width=\"907\" height=\"1014\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM.png 1088w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM-268x300.png 268w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM-916x1024.png 916w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM-768x858.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM-973x1087.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.45.41-PM-508x568.png 508w\" sizes=\"(max-width: 907px) 100vw, 907px\" \/><p id=\"caption-attachment-16448\" class=\"wp-caption-text\">The start of my menu. Another section was added later, Demo Mode, but I started by just including the main function and directions pages.<\/p><\/div>\n<div id=\"attachment_16447\" style=\"width: 1092px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16447\" loading=\"lazy\" class=\"wp-image-16447 size-full\" style=\"font-size: 16px\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM.png\" alt=\"\" width=\"1082\" height=\"1162\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM.png 1082w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM-279x300.png 279w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM-954x1024.png 954w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM-768x825.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM-973x1045.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.46.01-PM-508x546.png 508w\" sizes=\"(max-width: 1082px) 100vw, 1082px\" \/><p id=\"caption-attachment-16447\" class=\"wp-caption-text\">This was the hardest section to figure out. I had to create new pages for each of the three values and be able to change and save them returning to this screen.<\/p><\/div>\n<h4>-Review \/ Decision Points<\/h4>\n<h5>1. The Candy Shoot<\/h5>\n<div id=\"attachment_16454\" style=\"width: 836px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16454\" loading=\"lazy\" class=\"wp-image-16454 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.55.12-PM.png\" alt=\"\" width=\"826\" height=\"590\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.55.12-PM.png 826w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.55.12-PM-300x214.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.55.12-PM-768x549.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.55.12-PM-508x363.png 508w\" sizes=\"(max-width: 826px) 100vw, 826px\" \/><p id=\"caption-attachment-16454\" class=\"wp-caption-text\">This is a preliminary sketch. The original Plan was to incorporate the candy shoot and servo into the main box.<\/p><\/div>\n<div id=\"attachment_16455\" style=\"width: 1806px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16455\" loading=\"lazy\" class=\"wp-image-16455 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM.png\" alt=\"\" width=\"1796\" height=\"1280\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM.png 1796w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM-300x214.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM-1024x730.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM-768x547.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM-1536x1095.png 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM-973x693.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/Screen-Shot-2022-10-26-at-7.56.32-PM-508x362.png 508w\" sizes=\"(max-width: 1796px) 100vw, 1796px\" \/><p id=\"caption-attachment-16455\" class=\"wp-caption-text\">This was replaced with an external servo and candy shoot after I struggled to properly incorporate a working design into the main body.<\/p><\/div>\n<h5>2. How to keep track of time<\/h5>\n<p>The original plan was to keep track of time with a Real Time Clock Module. This module can be seen in some of my process photos. However I realized this was difficult to implement and I did not need to keep track of the actual time, just how long a minute is. So I opted to take this out and keep track of my time using the millis() function. 1000 milliseconds = 1 second so I could use millis to keep track of the seconds and count down. I found it much easier to implement and overall simpler for the purposes of my project.<\/p>\n<h2 style=\"text-align: left\">Schematic &amp; Block Diagram<\/h2>\n<h4>Schematic<\/h4>\n<div id=\"attachment_16431\" style=\"width: 522px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16431\" loading=\"lazy\" class=\"wp-image-16431\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddySchematic.drawio.png\" alt=\"\" width=\"512\" height=\"567\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddySchematic.drawio.png 669w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddySchematic.drawio-272x300.png 272w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><p id=\"caption-attachment-16431\" class=\"wp-caption-text\">Electrical schematic of the Study Buddy.<\/p><\/div>\n<h4>Block Diagram<\/h4>\n<div id=\"attachment_16432\" style=\"width: 796px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16432\" loading=\"lazy\" class=\"wp-image-16432\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddyBlockDiagram.drawio.png\" alt=\"\" width=\"786\" height=\"389\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddyBlockDiagram.drawio.png 891w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddyBlockDiagram.drawio-300x148.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddyBlockDiagram.drawio-768x380.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/10\/StudyBuddyBlockDiagram.drawio-508x251.png 508w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><p id=\"caption-attachment-16432\" class=\"wp-caption-text\">Block Diagram for the different inputs\/outputs in the Study Buddy.<\/p><\/div>\n<h3><\/h3>\n<h2 style=\"text-align: left\">Code<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n#include &lt;Servo.h&gt;\r\n\r\n\/\/\/----THE STUDY BUDDY-----\/\/\/\r\n\/\/----Jonathan Lindstrom---\/\/\r\n\r\n\/\/This project is intended to help an individual study more\r\n\/\/Productively. It implements an intuitive UI to help the\r\n\/\/User set the total time they want to study for, the time for working, and the time for breaks\r\n\/\/The default is the pomodoro method which is 25 minutes of work with a 5 minute break.\r\n\/\/The user is also able to pause at any point for a break by pressing the joystick.\r\n\/\/Once total time is up it triggers a servo motor releasing some candy for a reward.\r\n\r\n\/\/-----PIN MAPPING--------\/\/\r\n\/\/| Joy X Axis --&gt;    A0   |\r\n\/\/| Joy X Axis --&gt;    A1   |\r\n\/\/| Joy Button --&gt;    2    |\r\n\/\/| Servo      --&gt;    5    |\r\n\/\/| Green LED  --&gt;    6    |\r\n\/\/| LCD Pins   --&gt; SDA\/SCL |\r\n\r\n\/\/-----VARIABLES-------\/\/\/\r\n\r\n\/\/----CONSTANTS----\/\/\r\nServo gaugeMotor;\r\nconst int QUARTERWAIT = 250;\r\nconst int VRX = A0;\r\nconst int VRY = A1;\r\nconst int SW = 2;\r\nconst int HOMEBUT = 9;\r\nconst int GREEN = 6;\r\nconst int SERVO = 5;\r\n\r\n\/\/--MAIN FUNCTIONS---\/\/\r\nString joyPos = \"\"; \/\/Gets the joy position as \"UP, DOWN, LEFT, OR RIGHT\" Depending on joystick position\r\nString screenState = \"HOME\"; \/\/HOME, DIRECTIONS, OPTIONS, TOTAL, STUDY, BREAK, STUDYING, Used to tell the arduino which screen to display\r\n\r\n\r\n\/\/-----NUMS TO REPRESENT THE DIFFERENT SCREENS----\/\/\r\nint screenHome = 0;\/\/0-1 for 2 options\r\nint screenOptions = 0; \/\/0-3 for 4 options\r\nint screenDirections = 0; \/\/0-3 for 4 options\r\nboolean screenStudying = false;\r\n\r\n\/\/----INPUT VARIABLES-----??\r\nint joyOnlyOnce = 0;\/\/Makes sure that numbers can only change only once everytime the joystick is pressed\r\nint joyButOnce = 0; \/\/Makes sure joy button is only pressed once\r\nint buttonState = 0; \/\/State of JoyStick Button\r\nint homeButtonState = 0; \/\/Keeps Track of Button State of Home Button\r\n\r\n\/\/---VARIABLES FOR TIME\/TIME CHECKS----\/\/\r\nint totalTime = 60; \/\/Total Time with Studys AND Breaks\r\nint studyTime = 25; \/\/Total Time of each sec studying\r\nint breakTime = 5; \/\/Total Time of each break\r\nboolean place = true; \/\/Placeholder booleans that allow for\r\nboolean pause = false; \/\/Keeping make sure specific parts of the code run only once\r\nboolean light = true;\r\nint check = 1;\r\nint totalPlace = totalTime; \/\/Make a copy of totalTime that can be altered\r\nlong mins = - 1;\r\nlong sec = 60;\r\nint millPerSec = 1000; \/\/Used to change for Demo Mode\r\n\r\n\/\/---LCD VARIABLES----\/\/\r\nunsigned long quarterTimer = 0;\r\nLiquidCrystal_I2C screen(0x27, 20, 4); \/\/Initilize screen\r\n\r\n\r\n\r\nvoid setup() {\r\n  gaugeMotor.attach(SERVO);\r\n  Serial.begin(9600);\r\n  screen.init();\r\n  screen.backlight();\r\n\r\n  pinMode(VRX, INPUT);\r\n  pinMode(VRY, INPUT);\r\n  pinMode(SW, INPUT_PULLUP);\r\n  pinMode(HOMEBUT, INPUT);\r\n  pinMode(GREEN, OUTPUT);\r\n  digitalWrite(GREEN, HIGH);\r\n}\r\n\r\nvoid loop() {\r\n  millis(); \/\/Start Millis\r\n  joyPosition(); \/\/Call JoyStick Functions in loops so the values are always changing with accordance to joystick position and Screen\r\n  joyRight();\r\n  joyLeft();\r\n  joyUp();\r\n  joyDown();\r\n  joyButtonPressed(); \/\/Checks all cases in which pressing the Joystick will cause a change in screen\r\n  homeButtonPressed(); \/\/Checks if at any point the home button is pressed\r\n\r\n  if (pause) { \/\/Makes light blink when in pause\r\n    blinkLight();\r\n  }\r\n  if (!pause) { \/\/LED solid green otherwise when the device is on\r\n    digitalWrite(GREEN, LOW);\r\n  }\r\n\r\n  \/\/LCD will change depending on the screenState and display the right screen accordingly. This is constantly changing.\r\n  if (screenState == \"HOME\") {\r\n    homeScreen();\r\n    resetVals();\r\n  }\r\n\r\n  if (screenState == \"DIRECTIONS\") {\r\n    printDirections();\r\n  }\r\n\r\n  if (screenState == \"OPTIONS\") {\r\n    optionsScreen();\r\n  }\r\n\r\n  if (screenState == \"TOTAL\") {\r\n    totaltimeScreen();\r\n  }\r\n\r\n  if (screenState == \"STUDY\") {\r\n    studytimeScreen();\r\n  }\r\n\r\n  if (screenState == \"BREAK\") {\r\n    breaktimeScreen();\r\n  }\r\n  if (screenState == \"STUDYING\") {\r\n    studyingScreen();\r\n    timeCheck();\/\/Keep Track of Mins and Secs with millis(). Use when study screen is brought up;\r\n  }\r\n  if (screenState == \"COMPLETE\") {\r\n    completeScreen();\r\n  }\r\n\r\n}\r\n\r\n\r\n\r\n\/\/==========JOYSTICK FUNCTIONS==========\/\/\r\nvoid joyPosition() {\r\n  if (analogRead(VRX) &gt; 900) {\r\n    joyPos = \"LEFT\";\r\n  }\r\n  else if (analogRead(VRX) &lt; 100) {\r\n    joyPos = \"RIGHT\";\r\n  }\r\n  else if (analogRead(VRY) &lt; 100) {\r\n    joyPos = \"DOWN\";\r\n  }\r\n  else if (analogRead(VRY) &gt; 900) {\r\n    joyPos = \"UP\";\r\n  }\r\n  else {\r\n    joyPos = \"NEUTRAL\";\r\n    joyOnlyOnce = 0;\r\n  }\r\n\r\n}\r\nvoid homeButtonPressed() { \/\/Will go to home screen from any point in the code\r\n  homeButtonState = digitalRead(HOMEBUT);\r\n  if (homeButtonState) {\r\n    screenState = \"HOME\";\r\n    totalTime = 60; \r\n    studyTime = 25; \r\n    breakTime = 5; \r\n    millPerSec = 1000; \/\/Resets actual mill of a second to 1000 --&gt; Demo Mode\r\n    pause = false;\r\n    check = 1;\r\n    screenDirections = 0;\r\n\r\n    screen.clear();\r\n  }\r\n}\r\nvoid joyButtonPressed() { \/\/Performs all functions for the Joystick being pressed\r\n  buttonState = digitalRead(SW);\r\n  if (buttonState == 0) {\r\n    if (joyButOnce == 0) {\r\n      joyButOnce = 1;\r\n      screen.clear();\r\n\r\n      if (screenState == \"HOME\") {\r\n        if (screenHome == 1) {\r\n          screenState = \"DIRECTIONS\";\r\n        }\r\n        if (screenHome == 0) {\r\n          screenState = \"OPTIONS\";\r\n        }\r\n        if (screenHome == 2) {\r\n          demo();\r\n        }\r\n      }\r\n\r\n      else if (screenState == \"OPTIONS\") {\r\n        if (screenOptions == 0) {\r\n          screenState = \"STUDYING\";\r\n          setMins();\r\n        }\r\n        if (screenOptions == 1) {\r\n          screenState = \"TOTAL\";\r\n        }\r\n        if (screenOptions == 2) {\r\n          screenState = \"STUDY\";\r\n        }\r\n        if (screenOptions == 3) {\r\n          screenState = \"BREAK\";\r\n        }\r\n      }\r\n\r\n      else if (screenState == \"TOTAL\" || screenState == \"STUDY\" || screenState == \"BREAK\") {\r\n        screenState = \"OPTIONS\";\r\n      }\r\n\r\n      else if (screenState == \"STUDYING\") {\r\n        pause = !pause;\r\n      }\r\n\r\n\r\n    }\r\n  }\r\n\r\n  if (buttonState == 1) {\r\n    joyButOnce = 0;\r\n  }\r\n}\r\n\r\n\r\nvoid joyUp() { \/\/Performs all functions and changes when the Joystick is pushed up\r\n  if (joyPos == \"UP\") {\r\n    if (screenState == \"HOME\") {\r\n      if (joyOnlyOnce == 0) {\r\n        screenHome -= 1;\r\n        screen.clear();\r\n        joyOnlyOnce = 1;\r\n        if (screenHome &lt;= -1) {\r\n          screenHome = 2;\r\n        }\r\n      }\r\n    }\r\n    if (screenState == \"OPTIONS\") {\r\n      if (joyOnlyOnce == 0) {\r\n        screenOptions -= 1;\r\n        screen.clear();\r\n        joyOnlyOnce = 1;\r\n        if (screenOptions &lt;= -1) {\r\n          screenOptions = 3;\r\n        }\r\n      }\r\n    }\r\n    if (screenState == \"TOTAL\" || screenState == \"STUDY\" || screenState == \"BREAK\") {\r\n      if (joyOnlyOnce == 0) {\r\n        if (screenState == \"TOTAL\") {\r\n          totalTime += 5;\r\n          totalPlace = totalTime;\r\n        }\r\n        if (screenState == \"STUDY\") {\r\n          studyTime += 5;\r\n        }\r\n        if (screenState == \"BREAK\") {\r\n          breakTime += 5;\r\n        }\r\n        screen.clear();\r\n        joyOnlyOnce = 1;\r\n        if (totalTime &gt; 120) {\r\n          totalTime = 0;\r\n          totalPlace = totalTime;\r\n        }\r\n        if (studyTime &gt; 60) {\r\n          studyTime = 0;\r\n        }\r\n        if (breakTime &gt; 30) {\r\n          breakTime = 0;\r\n        }\r\n      }\r\n    }\r\n\r\n\r\n\r\n  }\r\n}\r\n\r\nvoid joyDown() { \/\/Performs all functions and changes when the Joystick is pushed down\r\n  if (joyPos == \"DOWN\") {\r\n    if (screenState == \"HOME\") {\r\n      if (joyOnlyOnce == 0) {\r\n        screenHome += 1;\r\n        screen.clear();\r\n        joyOnlyOnce = 1;\r\n        if (screenHome &gt;= 3) {\r\n          screenHome = 0;\r\n        }\r\n      }\r\n    }\r\n    if (screenState == \"OPTIONS\") {\r\n      if (joyOnlyOnce == 0) {\r\n        screenOptions += 1;\r\n        screen.clear();\r\n        joyOnlyOnce = 1;\r\n        if (screenOptions &gt;= 4) {\r\n          screenOptions = 0;\r\n        }\r\n      }\r\n    }\r\n\r\n    if (screenState == \"TOTAL\" || screenState == \"STUDY\" || screenState == \"BREAK\") {\r\n      if (joyOnlyOnce == 0) {\r\n        if (screenState == \"TOTAL\") {\r\n          totalTime -= 5;\r\n          totalPlace = totalTime;\r\n        }\r\n        if (screenState == \"STUDY\") {\r\n          studyTime -= 5;\r\n        }\r\n        if (screenState == \"BREAK\") {\r\n          breakTime -= 5;\r\n        }\r\n        screen.clear();\r\n        joyOnlyOnce = 1;\r\n        if (totalTime &lt; 0) {\r\n          totalTime = 120;\r\n          totalPlace = totalTime;\r\n        }\r\n        if (studyTime &lt; 0) {\r\n          studyTime = 60;\r\n\r\n        }\r\n        if (breakTime &lt; 0) {\r\n          breakTime = 30;\r\n        }\r\n      }\r\n    }\r\n\r\n\r\n  }\r\n}\r\n\r\nvoid joyRight() { \/\/\/\/Performs all functions and changes when the Joystick is pushed right\r\n  if (joyPos == \"RIGHT\") {\r\n    if (screenState == \"DIRECTIONS\") {\r\n      if (joyOnlyOnce == 0) { \/\/Navigate Directions\r\n        screen.clear();\r\n        screenDirections += 1;\r\n        joyOnlyOnce = 1;\r\n        if (screenDirections &gt;= 4) {\r\n          screenDirections = 0;\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\nvoid joyLeft() { \/\/Performs all functions and changes when the Joystick is pushed left\r\n  if (joyPos == \"LEFT\") {\r\n    if (screenState == \"DIRECTIONS\") {\r\n      if (joyOnlyOnce == 0) { \/\/Navigate Directions\r\n        screen.clear();\r\n        screenDirections -= 1;\r\n        joyOnlyOnce = 1;\r\n        if (screenDirections &lt;= -1) {\r\n          screenDirections = 3;\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\n\r\n\r\n\/\/===========SCREENS===========\/\/\r\n\r\nvoid directions1() { \/\/Directions screen 1\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Directions(1\/4):\");\r\n  screen.setCursor(0, 1);\r\n  screen.print(\"-Use stick to scroll\");\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"through directions\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"&lt;-- stick = joystick\");\r\n}\r\n\r\nvoid directions2() { \/\/Directions screen 2\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Directions(2\/4):\");\r\n  screen.setCursor(0, 1);\r\n  screen.print(\"-Press button to\");\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"right for home --&gt;\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"-Press on joy for Ok\");\r\n}\r\n\r\nvoid directions3() { \/\/Directions screen 3\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Directions(3\/4):\");\r\n  screen.setCursor(0, 1);\r\n  screen.print(\"-Numbers\");\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"Up for increase\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"Down for decrease\");\r\n}\r\n\r\nvoid directions4() { \/\/directions screen 4\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Directions(4\/4):\");\r\n  screen.setCursor(0, 1);\r\n  screen.print(\"Ok to pause timer\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"Press Home :)\");\r\n}\r\n\r\nvoid printDirections() { \/\/ScreenState DIRECTIONS, Changes the directions page accordingly\r\n  if (screenDirections == 0) {\r\n    directions1();\r\n  }\r\n  if (screenDirections == 1) {\r\n    directions2();\r\n  }\r\n  if (screenDirections == 2) {\r\n    directions3();\r\n  }\r\n  if (screenDirections == 3) {\r\n    directions4();\r\n  }\r\n}\r\n\r\nvoid homeScreen() { \/\/ScreenState HOME\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Home:\");\r\n  screen.setCursor(4, 1);\r\n  screen.print(\"Start Studying\");\r\n  screen.setCursor(4, 2);\r\n  screen.print(\"Directions\");\r\n  screen.setCursor(4, 3);\r\n  screen.print(\"Demo Mode\");\r\n  if (screenHome == 0) {\r\n    screen.setCursor(0, 1);\r\n  }\r\n  if (screenHome == 1) {\r\n    screen.setCursor(0, 2);\r\n  }\r\n  if (screenHome == 2) {\r\n    screen.setCursor(0, 3);\r\n  }\r\n  screen.print(\"--&gt;\");\r\n}\r\n\r\nvoid optionsScreen() { \/\/ScreenState OPTIONS\r\n\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Options:\");\r\n  screen.setCursor(3, 1);\r\n  screen.print(\"Time Total = \");\r\n  screen.setCursor(3, 2);\r\n  screen.print(\"Time Study = \");\r\n  screen.setCursor(3, 3);\r\n  screen.print(\"Time Break = \");\r\n  screen.setCursor(15, 0);\r\n  screen.print(\"OK?\");\r\n\r\n  if (screenOptions == 0) {\r\n    screen.setCursor(12, 0);\r\n  }\r\n  if (screenOptions == 1) {\r\n    screen.setCursor(0, 1);\r\n  }\r\n  if (screenOptions == 2) {\r\n    screen.setCursor(0, 2);\r\n  }\r\n\r\n  if (screenOptions == 3) {\r\n    screen.setCursor(0, 3);\r\n  }\r\n  screen.print(\"--&gt;\");\r\n  screen.setCursor(16, 1);\r\n  screen.print(totalTime);\r\n  screen.setCursor(16, 2);\r\n  screen.print(studyTime);\r\n  screen.setCursor(16, 3);\r\n  screen.print(breakTime);\r\n}\r\n\r\nvoid totaltimeScreen() { \/\/Screen State TOTAL\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Total Time:\");\r\n  screen.setCursor(13, 0);\r\n  screen.print(totalTime);\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"Up\/Down to change\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"When Done Press Ok\");\r\n}\r\nvoid studytimeScreen() { \/\/ScreenState STUDY\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Study Time:\");\r\n  screen.setCursor(13, 0);\r\n  screen.print(studyTime);\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"Up\/Down to change\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"When Done Press Ok\");\r\n}\r\n\r\nvoid breaktimeScreen() { \/\/ScreenState BREAK\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"Break Time:\");\r\n  screen.setCursor(13, 0);\r\n  screen.print(breakTime);\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"Up\/Down to change\");\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"When Done Press Ok\");\r\n}\r\n\r\nvoid studyingScreen() {\/\/ScreenState STUDYING\r\n  screen.setCursor(0, 0);\r\n  if (screenStudying) {\r\n    screen.print(\"Study: \"); \/\/Changes depending on if user is studying or on break\r\n  }\r\n  if (!screenStudying) {\r\n    screen.print(\"Break: \");\r\n  }\r\n\r\n  screen.setCursor(7, 0);\r\n  screen.print(mins \/ 10);\r\n  screen.setCursor(8, 0);\r\n  screen.print(mins % 10);\r\n  screen.setCursor(9, 0);\r\n  screen.print(\":\");\r\n  screen.setCursor(10, 0);\r\n  screen.print(sec \/ 10);\r\n  screen.setCursor(11, 0);\r\n  screen.print(sec % 10);\r\n  screen.setCursor(0, 1);\r\n  screen.print(\"--------------------\");\r\n  screen.setCursor(0, 2);\r\n  if (pause) {\r\n    screen.print(\"Press Ok to Continue\");\r\n  }\r\n  else if (screenStudying) {\r\n    screen.print(\"Good Luck! Work Hard\");\r\n  }\r\n  else if (!screenStudying) {\r\n    screen.print(\"Enjoy Your Break!   \");\r\n  }\r\n  screen.setCursor(0, 3);\r\n  screen.print(\"Home=Quit, Ok=Pause\");\r\n\r\n\r\n}\r\n\r\nvoid completeScreen() { \/\/Displays completed when the user finishes. Dispenses candy, ScreenState COMPLETE\r\n  screen.setCursor(0, 0);\r\n  screen.print(\"GREAT STUDY SESSION!\");\r\n  screen.setCursor(0, 2);\r\n  screen.print(\"Candy Dispensing :)\");\r\n  screen.setCursor(5, 3);\r\n  screen.print(\"Press Home\");\r\n  if (check == 1) { \/\/Makes sure the candy code only runs once each COMPLETE screen\r\n    gaugeMotor.write(0);\r\n    delay(5000); \/\/Delay to make sure that the candy is properly dispensed and servo reset before the user can go home or start studying again\r\n    gaugeMotor.write(90);\r\n    check = 0;\r\n  }\r\n}\r\n\r\n\/\/=========TIME &amp; DEMO FUNCTIONS======\/\/\r\n\r\nvoid timeCheck() { \/\/Keeps track of time using millis to count seconds and minutes\r\n  static long t = 0;\r\n  if (!pause) {\r\n    if (millis() - t &gt;= millPerSec) {\r\n      t = millis();\r\n      \/\/1 Second Passing\r\n      sec -= 1;\r\n      if (sec == 0) {\r\n        if (mins == 0 &amp;&amp; totalPlace &lt;= 0) {\r\n          screen.clear();\r\n          screenState = \"COMPLETE\";\r\n        }\r\n        mins -= 1;\r\n        sec = 60;\r\n      }\r\n    }\r\n    if (mins == -1) {\r\n      setMins(); \/\/Onces mins set runs out it changes it accordingly to breakTime\/StudyTime\r\n    }\r\n  }\r\n}\r\n\r\nvoid setMins() { \/\/resets mins alternating between break and studying when called\r\n  if (place) {\r\n    mins = studyTime - 1;\r\n    place = !place;\r\n    screenStudying = !screenStudying;\r\n  }\r\n\r\n  else {\r\n    mins = breakTime - 1;\r\n    place = !place;\r\n    screenStudying = !screenStudying;\r\n  }\r\n  if (totalTime != totalPlace &amp;&amp; totalPlace != 0) { \/\/Only runs this after the start\r\n    pause = true;\r\n  }\r\n  totalPlace -= mins + 1;\r\n\r\n}\r\n\r\nvoid resetVals() { \/\/RESETS VALS\r\n  mins = studyTime - 1;\r\n  sec = 60;\r\n  place = true;\r\n  totalPlace = totalTime;\r\n  screenStudying = false;\r\n}\r\n\r\nvoid demo() { \/\/Demo mode\r\n  millPerSec = 100;\r\n  totalTime = 3;\r\n  totalPlace = totalTime;\r\n  studyTime = 1;\r\n  breakTime = 1;\r\n  screenState = \"OPTIONS\";\r\n}\r\n\r\nvoid blinkLight() { \/\/Causes Green LED To Blink\r\n  static int t = 0; \/\/For alt between break\/study and for pauses\r\n  if (millis() - t &gt;= 250) {\r\n    if (light) {\r\n      digitalWrite(GREEN, LOW);\r\n      light = !light;\r\n    }\r\n    else if (!light) {\r\n      digitalWrite(GREEN, HIGH);\r\n      light = !light;\r\n    }\r\n    t = millis();\r\n\r\n\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By: Jonathan Lindstrom What is it? The Study Buddy helps keeps you focused while studying and gives you a sweet reward after intense study sessions. Discussion For my&#8230;<\/p>\n","protected":false},"author":230,"featured_media":16435,"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\/f2022\/work\/wp-json\/wp\/v2\/posts\/16427"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/users\/230"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/comments?post=16427"}],"version-history":[{"count":15,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16427\/revisions"}],"predecessor-version":[{"id":16523,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16427\/revisions\/16523"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/media\/16435"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/media?parent=16427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/categories?post=16427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/tags?post=16427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}