{"id":13037,"date":"2021-04-09T16:56:16","date_gmt":"2021-04-09T20:56:16","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/?p=13037"},"modified":"2021-04-09T16:58:58","modified_gmt":"2021-04-09T20:58:58","slug":"digital-refrigerator-inventory-by-sunjana-kulkarni","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/digital-refrigerator-inventory-by-sunjana-kulkarni\/","title":{"rendered":"Digital Refrigerator Inventory: by Sunjana Kulkarni"},"content":{"rendered":"<h2>Project<\/h2>\n<p>This device keeps track of items in the user&#8217;s refrigerator as well as their expiry dates, displaying items that are going to expire in 3 or fewer days, and the user can add and delete items with pre-set names and expiry dates, custom dates, or both custom names and dates.<\/p>\n<p>Below is a couple seconds of interaction with the device:<\/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-13037-1\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/quick_show.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/quick_show.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/quick_show.mp4<\/a><\/video><\/div>\n<p>Below is an image of the device with its internal components tucked inside:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-13068\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-scaled.jpeg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-scaled.jpeg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/B56A422B-1CBE-4EDD-81DC-DE40A9FA75C3-508x381.jpeg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p>Below is an image of the device with its internal components outside:<\/p>\n<div id=\"attachment_13061\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13061\" loading=\"lazy\" class=\"wp-image-13061 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-scaled.jpeg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-scaled.jpeg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/4FD815C6-9782-4671-8FA2-1020DF78ECFC-508x381.jpeg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-13061\" class=\"wp-caption-text\">Container for lcd display on left, actual electrical components on the right<\/p><\/div>\n<p>Below are videos of various device capabilities:<\/p>\n<p>Adding item w pre-set name and expiry date<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13037-2\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/spinach.MOV.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/spinach.MOV.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/spinach.MOV.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p>Adding item w pre-set name and custom expiry date<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13037-3\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/adding_milk.mp4?_=3\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/adding_milk.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/adding_milk.mp4<\/a><\/video><\/div>\n<p>Adding item w custom expiry date\/name<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13037-4\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/custom.mp4?_=4\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/custom.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/custom.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p>Deleting item<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13037-5\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/deletion.MOV.mp4?_=5\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/deletion.MOV.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/deletion.MOV.mp4<\/a><\/video><\/div>\n<p>Process Images<\/p>\n<p>Below is a sketch from my ideation process, when I was drawing out different devices I wanted to build:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-13111\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F.jpeg\" alt=\"\" width=\"580\" height=\"350\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F.jpeg 1620w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F-300x181.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F-1024x619.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F-768x464.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F-1536x928.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F-973x588.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C84953F0-D9E8-4C16-9B93-D3643790A75F-508x307.jpeg 508w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/p>\n<p>For my prototype, I constructed a setup with 2 buttons that were each hard coded to different items that I wanted to add (cilantro, spinach), thinking that if I was able to add and remove items through these buttons, I could achieve something similar with pressing buttons on the remote. Below is an image of that prototype<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-13095\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-scaled.jpeg\" alt=\"\" width=\"381\" height=\"508\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-scaled.jpeg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-225x300.jpeg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-768x1024.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-1152x1536.jpeg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-1536x2048.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-973x1297.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/C8221FB8-0E90-4301-AA3A-F360E0B0E410-508x677.jpeg 508w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/p>\n<p>Finally, after I had finished the electrical and software-related portions of my project, I had to design the box that would display my screen and have a window for the infrared receiver to receive a signal from my remote. I had to measure the length and width of the lcd and determine a height at which it could be situated, and to create the window for the IR receiver, I had to determine the height and width at which it was visible when the breadboard was placed inside the box.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-13116\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-scaled.jpg\" alt=\"\" width=\"382\" height=\"286\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/IMG_1411-508x381.jpg 508w\" sizes=\"(max-width: 382px) 100vw, 382px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>A key decision point in my process was using a list of structs instead of a linked list to store all of the items. This was simply because structs were more appropriate: I could index a specific part of the list to delete it, instead of relying on iterating through all of the nodes in the linked list through a while loop, which would cause more complications. Also, since there weren&#8217;t many items I would have in my fridge at any one time, I decided that I didn&#8217;t need an unbounded linked list so I could infinitely add items, and instead I enabled them to be placed in a 15-struct array. This greatly simplified the process of adding and deleting items, as well as iterating through items that were expiring.<\/p>\n<p>Below was my linked list definition:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">class groceryItem {\r\n      public:\r\n         int dTE;\r\n         char* expiryDate;\r\n         char* name;\r\n         groceryItem* next;\r\n         groceryItem* back;\r\n};\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Below is my struct definition:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">struct listItem{\r\n  char* item = \"\";\r\n  byte dTE;\r\n  byte ref; \/\/this is the reference number of days til expiry, this is set during the \"setup\" stage\r\n  byte dateAdded[2]; \/\/day, month\r\n  byte amount; \/\/will be 0, 1, or 2\r\n  byte replacementDate[2]; \/\/day, month\r\n  bool isEmpty; \/\/we just need to check for this one thing  \r\n  byte replacementRef; \/\/we're only gonna use this for custom items\r\n};<\/pre>\n<p>Another key decision point in my process was choosing to include a T9 system to add some complexity to my project. This idea came to me after I had struggled to get addition and deletion working with linked lists, and once I realized that addition and deletion was going to be made much easier with structs, I decided to increase the complexity of my project and challenge myself to implement a timing system with IR receiver signals that would allow for addition of custom names and expiry dates. Overall, this challenge enabled me to make my project more versatile and suited for my personal use, where I have to keep track of random Indian cooking ingredients and dairy products with pre-set expiries.<\/p>\n<h2>Discussion<\/h2>\n<p><span style=\"font-weight: 400\">When I set about completing this project, I anticipated having difficulty in figuring out how to enable adding items with custom dates and names using the t-9 system. What I didn\u2019t realize was that understanding how to use multiple calls to receiver.decode() and enabling custom item name adding would take up most of my time. I had to learn, through trial and error with receiver.decode() and by looking at the (comparatively simple) IR receiver code example, that I should structure my code such that only actions directly using the decoded signal should be inside the if(receiver.decode(&amp;results)) statement, and all other actions (i.e. resetting timers so as to move to next letter and listen to signals) should be outside of the statement. I\u2019d also forgotten how strings worked in C++, and it took some time to figure out where and how to update a string in my code letter by letter without completely overwriting the previous letters.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Overall, I\u2019m pleased that I reached my goal of building the functioning T-9 system that could be used to add custom names and dates, having the expiring items loop across the screen, and enabling adding and deletion of items. However, next time I work with a new electronic component, I\u2019ll look for more complicated code examples in order to get a better understanding of the corresponding commands, and I\u2019ll space my programming out across several days so I don\u2019t run into several technical bugs the day before a deadline. I also agree with my classmate\u2019s critique (regarding my physical setup) that \u201cinstead of a white box, have a clear acrylic box or even a black box to store the electronic components? Just for aesthetic purposes\u201d. In the future, I\u2019d learn\u00a0 laser cutting and plan my physical design early on, so I could use the Hunt laser cutter during the weekdays and not have to rely on using the materials I have in my apartment the night before.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">As for working on the project in the future, one classmate had an interesting idea of including a \u201cscrolling system to move through each item manually if you just want to look at one expiration date\u201d. This would be very useful for pinpointing a specific item\u2019s expiry date without having to dig through the fridge to find the item and determine if it\u2019s expired. I also liked another classmate\u2019s idea of including a distance sensor so the screen was only active when it was being viewed.\u00a0<\/span><\/p>\n<h2>Technical Information<\/h2>\n<h3>Block Diagram<\/h3>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-13118\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks.jpg\" alt=\"\" width=\"1031\" height=\"331\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks.jpg 1031w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks-300x96.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks-1024x329.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks-768x247.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks-973x312.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_blocks-508x163.jpg 508w\" sizes=\"(max-width: 1031px) 100vw, 1031px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Schematic<\/h3>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-13170\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_schematic-1.jpg\" alt=\"\" width=\"673\" height=\"792\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_schematic-1.jpg 673w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_schematic-1-255x300.jpg 255w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/04\/Project_2_schematic-1-508x598.jpg 508w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Code<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/* 60-223, Project 2\r\n *  Sunjana Kulkarni (sunjanak)\r\n *  time spent: 20 hours\r\n *  No Collaboration\r\n *  Project description: Information about each item\r\n *  in your refrigerator is stored through an array of structs\r\n *  You can add items that have pre-set names and expiry dates\r\n *  by using the \"up\" arrow on the remote and pressing a number from 0 to 4, \r\n *  you can add items with pre-set names and a custom expiry date by \r\n *  using the \"up\" arrow and pressing a number from 5-9, and you can add a completely\r\n *  custom item by pressing the \"up\" arrow and pressing \"EQ\", and then typing in\r\n *  the name and date of your item. You can delete any item \r\n *  with a pre-set name by pressing the corresponding number button of that item. The code\r\n *  calculates expiry dates using an RTC module, which gets the current date. \r\n *  \r\n *  PinMapping \r\n *  \r\n *  Arduino Pin | type | description\r\n *  ---------------------------------\r\n *  11            input   connecting to IR reciever\r\n *  A4            input   connecting to RTC\r\n *  A5            input   connecting to RTC\r\n *  SDA           output  lcd\r\n *  SCL           output  lcd\r\n *\/\r\n\r\n \/* I utilized rtc module and IR reciever syntax from introductory source code found on both the Ideate website and within\r\n  *  Arduino library, in my setup function. \r\n  *\/\r\n \r\n#include &lt;IRremote.h&gt;\r\n#include \"RTClib.h\"\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\nusing namespace std;\r\n\r\nDateTime now;\r\n\r\nRTC_DS3231 rtc;\r\n\r\n\/\/taken from this site \r\n\r\n\r\nbyte RECV_PIN = 11;    \r\n\r\nbool addMode;\r\nbool deleteMode;\r\nbool custom = false;\r\nbyte addNum;\r\nbyte deleteNum;\r\n\/\/void showDate(void);\r\n\r\nunsigned long addTimer = 0;\r\nunsigned long deleteTimer = 0;\r\n\r\n\r\nIRrecv receiver(RECV_PIN);  \/\/  Create a new receiver object that would decode signals to key codes\r\ndecode_results results;     \/\/  A variable that would be used by receiver to put the key code \r\n\r\n\r\n\r\nLiquidCrystal_I2C lcd(0x27, 20, 4);\r\n\r\n\r\nconst byte list_length = 15;\r\n\r\nstruct listItem{\r\n  char* item = \"\";\r\n  byte dTE;\r\n  byte ref; \/\/this is the reference number of days til expiry, this is set during the \"setup\" stage\r\n  byte dateAdded[2]; \/\/day, month\r\n  byte amount; \/\/will be 0, 1, or 2\r\n  byte replacementDate[2]; \/\/day, month\r\n  bool isEmpty; \/\/we just need to check for this one thing  \r\n  byte replacementRef; \/\/we're only gonna use this for custom items\r\n};\r\n\r\n\r\n\r\n\r\nlistItem groceryList[list_length];\r\n\r\n\r\n\/\/have some builtins where u have to input the expiry date (still needs nokia system)\r\n\/\/builtins with expiry date: milk, cheddar, sour cream, yogurt, eggs\r\n\r\nbyte pointer = 0;\r\nbyte totalCustom = 0; \/\/total amount of custom items in our list\r\nbyte freeCustom = 10; \/\/the next free spot to put a custom item\r\nbyte freeCD = -1; \/\/we set this to whatever custom date item we're adding\r\n\r\nbool wasReset = false; \/\/sets to true every time appears on screen, sets to false right after\r\nunsigned long lrdt = 0;\r\nbool nokiaMode = false;\r\n\r\nunsigned long nok = millis();\r\nbyte cP = 0; \/\/cursor position\r\nbyte presses = 0;\r\nchar* item = \"\"; \/\/how wide the board is\r\nchar* letter;\r\nbool finishedItem = false; \/\/this is set to true when we finish inputting the item, we still gotta input the date \r\nbyte dateItemsAdded = 0; \/\/once this hits 3, we've added everything\r\nbyte expiryDay = 0;\r\nbyte expiryMonth = 0;\r\nbyte currNum = 0;\r\nbool buttonWasPressed = false;\r\n\r\nvoid setup() {\r\n  lcd.init();\r\n  lcd.backlight();\r\n  Serial.begin(9600); \r\n  \/\/flash items about to expire in a loop\r\n  receiver.enableIRIn();    \/\/  Enable receiver so that it would start processing infrared signals\r\n  lcd.home();\r\n  lcd.print(\"hello, world!\");\r\n  delay(100);\r\n  lcd.clear();\r\n  if (! rtc.begin()) \r\n  {\r\n    while (1);\r\n  }\r\n\r\n  if (rtc.lostPower()) \r\n  {\r\n    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));\r\n  }\r\n  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));\r\n  for(byte i = 0; i &lt; list_length; i++){\r\n    groceryList[i].amount = 0;\r\n    switch(i){\r\n      case 0:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"cilantro\";\r\n        groceryList[i].ref = 3;\r\n        break;\r\n      case 1:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"spinach\";\r\n        groceryList[i].ref = 3;\r\n        break;\r\n      case 2:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"jalapenos\";\r\n        groceryList[i].ref = 7;\r\n        break;\r\n      case 3:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"daal\";\r\n        groceryList[i].ref = 4;\r\n        break;\r\n      case 4:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"curry\";\r\n        groceryList[i].ref = 3;\r\n        break;   \/\/everything 5 onwards doesn't have a reference expiry, so just put dummy numbers \r\n      case 5:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"milk\";\r\n        groceryList[i].ref = 2000;\r\n        break;\r\n      case 6:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"cheese\";\r\n        groceryList[i].ref = 2000;\r\n        break;\r\n      case 7:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"sour crm\";\r\n        groceryList[i].ref = 2000;\r\n        break;\r\n      case 8:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"yogurt\";\r\n        groceryList[i].ref = 2000;\r\n        break;\r\n      case 9:\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].item = \"eggs\";\r\n        groceryList[i].ref = 2000;\r\n        break;    \r\n    }\r\n    \r\n  }\r\n\r\n}\r\n\r\n\r\nbool copied = false;\r\nbyte regularHasher(String hex){\r\n  if(hex == \"ff6897\"){\r\n    return 0;\r\n  }\r\n  else if(hex == \"ff30cf\"){\r\n    return 1;\r\n  }\r\n  else if(hex == \"ff18e7\"){\r\n    return 2;\r\n  }\r\n  else if(hex == \"ff7a85\"){\r\n    return 3;\r\n  }\r\n  else if(hex == \"ff10ef\"){\r\n    return 4;\r\n  }\r\n  else if(hex == \"ff38c7\"){\r\n    return 5;\r\n  }\r\n  else if(hex == \"ff5aa5\"){\r\n    return 6;\r\n  }\r\n  else if(hex == \"ff42bd\"){\r\n    return 7;\r\n  }\r\n  else if(hex == \"ff4ab5\"){\r\n    return 8;\r\n  }\r\n  else if(hex == \"ff52ad\"){\r\n    return 9;\r\n  }\r\n  else{\r\n    return -1;\r\n  }\r\n  \r\n}\r\n\r\nchar* convertFromPress(byte presses, byte ind){\r\n  switch(ind){\r\n    case 1:\r\n        switch(presses % 3){\r\n          case 1:\r\n            return \"a\";\r\n            break;\r\n          case 2:\r\n            return \"b\";\r\n            break;\r\n          case 0:\r\n            return \"c\";\r\n            break;\r\n        }\r\n       break;\r\n   case 2:\r\n        switch(presses % 3){\r\n          case 1:\r\n            return \"d\";\r\n            break;\r\n          case 2:\r\n            return \"e\";\r\n            break;\r\n          case 0:\r\n            return \"f\";\r\n            break;\r\n        }\r\n       break;\r\n   case 3:\r\n           switch(presses % 3){\r\n          case 1:\r\n            return \"g\";\r\n            break;\r\n          case 2:\r\n            return \"h\";\r\n            break;\r\n          case 0:\r\n            return \"i\";\r\n            break;\r\n        }\r\n       break;\r\n   case 4:\r\n           switch(presses % 3){\r\n          case 1:\r\n            return \"j\";\r\n            break;\r\n          case 2:\r\n            return \"k\";\r\n            break;\r\n          case 0:\r\n            return \"l\";\r\n            break;\r\n        }\r\n       break;\r\n  case 5:\r\n       switch(presses % 3){\r\n          case 1:\r\n            return \"m\";\r\n            break;\r\n          case 2:\r\n            return \"n\";\r\n            break;\r\n          case 0:\r\n            return \"o\";\r\n            break;\r\n        }\r\n       break;\r\n case 6:\r\n        switch(presses % 3){\r\n          case 1:\r\n            return \"p\";\r\n            break;\r\n          case 2:\r\n            return \"q\";\r\n            break;\r\n          case 0:\r\n            return \"r\";\r\n            break;\r\n        }\r\n       break;\r\n case 7:\r\n        switch(presses % 3){\r\n          case 1:\r\n            return \"s\";\r\n            break;\r\n          case 2:\r\n            return \"t\";\r\n            break;\r\n          case 0:\r\n            return \"u\";\r\n            break;\r\n        }\r\n       break;\r\n case 8:\r\n         switch(presses % 3){\r\n          case 1:\r\n            return \"v\";\r\n            break;\r\n          case 2:\r\n            return \"w\";\r\n            break;\r\n          case 0:\r\n            return \"x\";\r\n            break;\r\n        }\r\n       break;\r\n case 9:\r\n      switch(presses % 2){\r\n        case 1:\r\n          return \"y\";\r\n          break;\r\n        case 0:\r\n          return \"z\";\r\n          break;\r\n      }\r\n    \r\n  }\r\n\r\n}\r\n\r\n\r\n\r\n\r\n\r\nvoid deleteIt(byte ind){\r\n    \/\/we're only going to delete one item from this, so there could still be an item left \r\n    if(ind &gt; 9){\r\n      freeCustom = ind;\r\n    }\r\n    \r\n    if(groceryList[ind].amount == 0){\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"There is no\");\r\n      lcd.setCursor(0, 1);\r\n      lcd.print(groceryList[ind].item);\r\n      delay(500);\r\n      lcd.clear();\r\n    }\r\n    else if(groceryList[ind].amount == 1){\r\n      groceryList[ind].amount -= 1;\r\n      groceryList[ind].isEmpty = true;\r\n      groceryList[ind].dTE = 0;\r\n      groceryList[ind].dateAdded[0] = 0;\r\n      groceryList[ind].dateAdded[1] = 0;\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"Just deleted\");\r\n      lcd.setCursor(0, 1);\r\n      lcd.print(groceryList[ind].item);\r\n      delay(500);\r\n      lcd.clear();\r\n    }\r\n    else{\r\n      groceryList[ind].amount -= 1;\r\n      if(ind &gt; 4){\r\n        groceryList[ind].ref = groceryList[ind].replacementRef;\r\n        groceryList[ind].replacementRef = 0;\r\n      }\r\n      groceryList[ind].dTE = groceryList[ind].ref;\r\n      groceryList[ind].dateAdded[0] = groceryList[ind].replacementDate[0];\r\n      groceryList[ind].dateAdded[1] = groceryList[ind].replacementDate[1];\r\n      \r\n      \r\n      groceryList[ind].replacementDate[0] = 0;\r\n      groceryList[ind].replacementDate[1] = 0;\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"Just deleted one of\");\r\n      lcd.setCursor(0, 1);\r\n      lcd.print(groceryList[ind].item);\r\n      delay(500);\r\n      lcd.clear();\r\n    }\r\n}\r\n\r\n\r\nvoid addItem(byte ind){\r\n  if(ind &lt; 5){\r\n\r\n  if(groceryList[ind].amount == 2){\r\n    lcd.setCursor(0, 0);\r\n    lcd.print(\"Can't add more\");\r\n    lcd.setCursor(0, 1);\r\n    lcd.print(\"Sorry :(\");\r\n    delay(500);\r\n    lcd.clear();\r\n  }\r\n  else if(groceryList[ind].amount == 1){\r\n\r\n    \/\/not changing dTE just yet\r\n    groceryList[ind].amount += 1;\r\n    groceryList[ind].replacementDate[0] = now.day();\r\n    groceryList[ind].replacementDate[1] = now.month();\r\n    \/\/adding the replacement date\r\n    lcd.setCursor(0, 0);\r\n    lcd.print(\"Just added another\");\r\n    lcd.setCursor(0, 1);\r\n    lcd.print(groceryList[ind].item);\r\n    delay(500);\r\n    lcd.clear(); \r\n  }\r\n  else{\r\n    \/\/filling in the dateAdded \r\n    groceryList[ind].dateAdded[0] = now.day();\r\n    groceryList[ind].dateAdded[1] = now.month();\r\n    groceryList[ind].dTE = groceryList[ind].ref;\r\n    groceryList[ind].isEmpty = false;\r\n    groceryList[ind].amount += 1;\r\n    lcd.setCursor(0, 0);\r\n    lcd.print(\"Just added\");\r\n    lcd.setCursor(0, 1);\r\n    lcd.print(groceryList[ind].item);\r\n    delay(500);\r\n    lcd.clear(); \r\n  }\r\n  }\r\n  else{\r\n    freeCD = ind;\r\n    nokiaMode = true;\r\n    \r\n  }\r\n}\r\n\r\n\r\n\/\/this is for custom date or custom item and date, either way, we've set the ref\r\nvoid addCustom(byte ind){\r\n  if(groceryList[ind].amount == 2 or (groceryList[ind].amount == 1 and custom)){\r\n    lcd.clear();\r\n    lcd.setCursor(0, 0);\r\n    lcd.print(\"Can't add more\");\r\n    lcd.setCursor(0, 1);\r\n    lcd.print(\"Sorry :(\");\r\n    delay(500);\r\n    lcd.clear();\r\n  }\r\n  else if(groceryList[ind].amount == 1 and !custom){\r\n\r\n    \/\/not changing dTE just yet\r\n    lcd.clear();\r\n    groceryList[ind].amount += 1;\r\n    groceryList[ind].replacementDate[0] = now.day();\r\n    groceryList[ind].replacementDate[1] = now.month();\r\n    \/\/adding the replacement date\r\n    lcd.setCursor(0, 0);\r\n    lcd.print(\"Just added another\");\r\n    lcd.setCursor(0, 1);\r\n    lcd.print(groceryList[ind].item);\r\n    delay(500);\r\n    lcd.clear(); \r\n  }\r\n  else{\r\n    \/\/filling in the dateAdded \r\n    lcd.clear();\r\n    groceryList[ind].dateAdded[0] = now.day();\r\n    groceryList[ind].dateAdded[1] = now.month();\r\n    groceryList[ind].dTE = groceryList[ind].ref;\r\n    groceryList[ind].isEmpty = false;\r\n    groceryList[ind].amount += 1;\r\n    lcd.setCursor(0, 0);\r\n    lcd.print(\"Just added\");\r\n    lcd.setCursor(0, 1);\r\n    lcd.print(groceryList[ind].item);\r\n\/\/    lcd.setCursor(0, 2);\r\n\/\/    lcd.print(groceryList[ind].ref);\r\n    delay(500);\r\n    lcd.clear(); \r\n  }\r\n  \r\n}\r\n\r\n\/\/returns 1 when done\r\nbool deleteAll(){\r\n    for(byte i = 0; i &lt; 20; i++){\r\n      if(!groceryList[i].isEmpty){\r\n        groceryList[i].amount = 0;\r\n        groceryList[i].isEmpty = true;\r\n        groceryList[i].dTE = 0;\r\n        groceryList[i].dateAdded[0] = 0;\r\n        groceryList[i].dateAdded[1] = 0;\r\n        groceryList[i].replacementDate[0] = 0;\r\n        groceryList[i].replacementDate[1] = 0; \r\n      }\r\n    }\r\n    return true;\r\n}\r\n\r\n\/\/we flash that something is expired the whole day it is expired\r\nvoid loop() {\r\n  now = rtc.now();\r\n\r\n  if(!nokiaMode and !custom){ \/\/once we've entered nokia mode, we're not leaving until we explicitly press the necessary button\r\nnow = rtc.now();\r\n  \r\n  if(pointer &gt;= list_length){\r\n    pointer = 0;\r\n  }\r\n\r\n  \/\/once the groceryList item stops being empty, we give it a ref that we calculated already \r\n  if(!groceryList[pointer].isEmpty){\r\n    \/\/recalculating the days til expiry\r\n      if(now.month() == groceryList[pointer].dateAdded[1]){\r\n        groceryList[pointer].dTE = groceryList[pointer].ref - (now.day() - groceryList[pointer].dateAdded[0]);\r\n      }\r\n      else{\r\n        \/\/we're just giving every month a default value of 31 days cuz we're in march now\r\n        groceryList[pointer].dTE = groceryList[pointer].ref - ((now.day() + (31 - groceryList[pointer].dateAdded[0])) - groceryList[pointer].dateAdded[0]);\r\n      }\r\n    }\r\n    \/\/not bothering with the year conversion yet \r\n  \r\n\r\n  \r\n  if(wasReset == false){\r\n    \r\n    lcd.setCursor(0, 0);\r\n    if(groceryList[pointer].isEmpty == false and groceryList[pointer].dTE &lt;= 3 and !addMode and !deleteMode){ \r\n      wasReset = true;\r\n\/\/      lcd.print(pointer);\r\n      lcd.print(groceryList[pointer].item);\r\n      lcd.print(\" expires in \");\r\n      lcd.setCursor(0, 1);\r\n      lcd.print(groceryList[pointer].dTE);\r\n      lcd.print(\" days\");\r\n    }\r\n    else{\r\n      pointer = pointer + 1; \/\/skipping over the empty ones\r\n    }\r\n    lrdt = millis();\r\n    \r\n  }\r\n\r\n   if(millis() - lrdt &gt;= 1000 and wasReset){\r\n    wasReset = false;\r\n    lcd.clear();\r\n    if(pointer + 1 &lt; list_length){\r\n      pointer = pointer + 1;\r\n    }\r\n    else{\r\n      pointer = 0;\r\n    }\r\n  }\r\n\r\n  if (receiver.decode(&amp;results)) {    \r\n    \/\/  Decode the button code and put it in \"results\" variable\r\n    String result = String(results.value, HEX);\r\n    \r\n    if(result == \"ff906f\"){\r\n      \/\/entering adding case\r\n      lcd.clear();\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"adding..\");\r\n      addMode = true;\r\n      addTimer = millis();\r\n      \r\n    }\r\n\r\n    if(result == \"ffe01f\"){\r\n      \/\/entering deletion case \r\n      lcd.clear();\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"deleting..\");\r\n      deleteMode = true;\r\n      deleteTimer = millis();\r\n    }\r\n\r\n    if(addMode and millis()-addTimer &lt; 3000 and regularHasher(String(results.value, HEX)) &gt; -1 and regularHasher(String(results.value, HEX)) &lt;= 9){\r\n      byte res = regularHasher(String(results.value, HEX));\r\n      addItem(res);\r\n      addMode = false;\r\n      \r\n    }\r\n\r\n    if(addMode and millis()-addTimer &lt; 3000 and result == \"ff9867\"){\r\n      custom = true;\r\n      nokiaMode = true;\r\n      addMode = false;\r\n    }\r\n\r\n     if(deleteMode and millis()-deleteTimer &lt; 3000 and regularHasher(String(results.value, HEX)) &gt; -1 and regularHasher(String(results.value, HEX)) &lt;= 9){\r\n      byte res = regularHasher(String(results.value, HEX));\r\n      deleteIt(res);\r\n      deleteMode = false;\r\n    }\r\n    receiver.resume(); \r\n                           \/\/  Continue listening for new signals\r\n  }\r\n\r\n    if(addMode and millis()-addTimer &gt;= 3000){\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"no add? ok\");\r\n      if(millis()-addTimer &gt;= 4000){\r\n        addMode = false;\r\n        lcd.clear();\r\n      }\r\n      \r\n    }\r\n\r\n    if(deleteMode and millis()-deleteTimer &gt;= 3000){\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"no delete? ok\");\r\n      if(millis()-addTimer &gt;= 4000){\r\n        deleteMode = false;\r\n        lcd.clear();\r\n      }\r\n    }\r\n\r\n\r\n\r\n\r\n  \/\/you can only add one of each custom item \r\n  delay(100); \/\/this adds a space at the end of the list\r\n  }\r\n  else{\r\n    now = rtc.now();\r\n    \/\/we press 0 to submit a string\r\n\/\/ will add these lines back in after figuring out nokia \/\/\r\n    if(custom and !finishedItem){\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"type your item\");\r\n      lcd.setCursor(0, 2);\r\n      lcd.print(\"press stop to clear\");\r\n      lcd.setCursor(0, 3);\r\n      lcd.print(\"finished? press up\");\r\n\r\n      if(receiver.decode(&amp;results) and !finishedItem){\r\n        Serial.println(String(results.value, HEX));\r\n        if(String(results.value, HEX) == \"ffe21d\"){\r\n          lcd.clear();\r\n          cP = 0;\r\n          presses = 0;\r\n          receiver.resume();\r\n        }\r\n        if(regularHasher(String(results.value, HEX)) &gt; 0 and regularHasher(String(results.value, HEX)) &lt;= 9 and !(millis()-nok &gt;= 1000 and buttonWasPressed)){\r\n          buttonWasPressed = true;\r\n          nok = millis(); \/\/we're resetting this every time we press the button\r\n          presses += 1;\r\n          letter = convertFromPress(presses, regularHasher(String(results.value, HEX)));\r\n          lcd.setCursor(cP, 1);\r\n          lcd.print(letter); \/\/this'll keep updating as long as you keep pressing\r\n          receiver.resume();\r\n          \r\n        }\r\n        if(String(results.value, HEX) == \"ff906f\"){\r\n          Serial.println(item);\r\n          finishedItem = true;\r\n          lcd.clear();\r\n          cP = 0;\r\n          presses = 0;\r\n          receiver.resume(); \r\n          \r\n        }\r\n        else{\r\n          receiver.resume();\r\n          \r\n        }\r\n\r\n        \r\n\r\n      }\r\n      \r\n      \r\n\r\n      if(!finishedItem and millis()-nok &gt;= 1000 and buttonWasPressed){ \/\/moving to the next letter, should only happen after you've stopped pressing\r\n        \r\n        groceryList[freeCustom].item = strcat(groceryList[freeCustom].item, letter);\r\n        if(cP &lt; 19){\r\n          cP += 1;\r\n        }\r\n        else{\r\n          cP = 0;\r\n        }\r\n        presses = 0;\r\n        nok = millis();\r\n        buttonWasPressed = false;\r\n      }\r\n\r\n    }\r\n\r\n    if((!custom and dateItemsAdded &lt; 2 and nokiaMode) or (custom and finishedItem)){\r\n      lcd.setCursor(0, 0);\r\n      if(dateItemsAdded == 0){\r\n        lcd.print(\"type expiry day\");\r\n      }\r\n      if(dateItemsAdded == 1){\r\n        lcd.print(\"type expiry month\");\r\n      }\r\n      lcd.setCursor(0, 2);\r\n      lcd.print(\"press stop to clear\");\r\n      lcd.setCursor(0, 3);\r\n      lcd.print(\"finished? press up\");\r\n      Serial.println(expiryDay);\r\n      Serial.println(expiryMonth);\r\n      \r\n      if(receiver.decode(&amp;results) and dateItemsAdded &lt; 2){\r\n        String res = String(results.value, HEX);\r\n        if(res == \"ff906f\"){\r\n          dateItemsAdded += 1;\r\n          lcd.clear();\r\n          cP = 0;\r\n          presses = 0;\r\n          buttonWasPressed = false;\r\n          receiver.resume();\r\n          \r\n        }\r\n        if(res == \"ffe21d\"){\r\n          lcd.clear();\r\n          cP = 0;\r\n          presses = 0;\r\n          if(dateItemsAdded == 0){\r\n            expiryDay = 0;\r\n          }\r\n          if(dateItemsAdded == 1){\r\n            expiryMonth = 0;\r\n          }\r\n          receiver.resume();\r\n        }\r\n        if(!(millis()-nok &gt;= 1000 and buttonWasPressed) and cP &lt;= 2){\r\n          if(regularHasher(res) &gt; -1 and regularHasher(res) &lt;= 9){\r\n            buttonWasPressed = true;\r\n            nok = millis(); \/\/we're resetting this every time we press the button\r\n            presses += 1;\r\n            currNum = regularHasher(String(results.value, HEX));\r\n            lcd.setCursor(cP, 1);\r\n            lcd.print(currNum); \/\/this'll keep updating as long as you keep pressing\r\n            receiver.resume(); \r\n          }\r\n          receiver.resume(); \r\n        }\r\n      }\r\n\r\n      if(millis()-nok &gt;= 1000 and buttonWasPressed){\r\n                if(dateItemsAdded == 0){\r\n        expiryDay = expiryDay * 10;\r\n        expiryDay += currNum;\r\n      }\r\n        if(dateItemsAdded == 1){\r\n          expiryMonth = expiryMonth * 10;\r\n          expiryMonth += currNum;\r\n        }\r\n        currNum = 0;\r\n        if(cP &lt; 2){\r\n          cP += 1;\r\n        }\r\n        presses = 0;\r\n        nok = millis();\r\n        buttonWasPressed = false;\r\n        \r\n      }\r\n        \r\n      } \r\n      \r\n      \r\n    \r\n    if(dateItemsAdded == 2 and nokiaMode){\r\n      \/\/now adding the ref for the custom items\r\n      if(custom and totalCustom &lt; list_length-9){\r\n        \/\/adding it to freeCustom\r\n        if(expiryMonth == (byte)now.month() or (expiryMonth &gt; 12 or expiryMonth &lt; 1)){\r\n            groceryList[freeCustom].ref = expiryDay - (byte)now.day();\r\n          addCustom(freeCustom);\r\n        }\r\n        else{\r\n          \r\n          groceryList[freeCustom].ref = 30 * (expiryMonth - ((byte)now.month() + 1)) + expiryDay + (31 - (byte)now.day());\r\n          addCustom(freeCustom);\r\n        }\r\n        \r\n      }\r\n      else{\r\n        Serial.println((byte)now.day());\r\n        Serial.println((byte)now.month());\r\n        Serial.println(expiryDay);\r\n        Serial.println(expiryMonth);\r\n        delay(100);\r\n        if((byte)expiryMonth == (byte)now.month() or (expiryMonth &gt; 12 or expiryMonth &lt; 1)){\r\n          if(groceryList[freeCD].amount &gt; 0){\r\n            groceryList[freeCD].replacementRef = (byte)expiryDay - (byte)now.day();\r\n            addCustom(freeCD);\r\n          }\r\n          else{\r\n            groceryList[freeCD].ref = (byte)expiryDay - (byte)now.day();\r\n          addCustom(freeCD);\r\n          }\r\n        }\r\n        else{\r\n          if(groceryList[freeCD].amount &gt; 0){\r\n            groceryList[freeCD].replacementRef = 30 * ((byte)expiryMonth - ((byte)now.month() + 1)) + (byte)expiryDay + (31 - (byte)now.day());\r\n            addCustom(freeCD);\r\n          }\r\n          else{\r\n          groceryList[freeCD].ref = 30 * ((byte)expiryMonth - ((byte)now.month() + 1)) + (byte)expiryDay + (31 - (byte)now.day());\r\n          addCustom(freeCD);\r\n          }\r\n        }\r\n        \r\n      }\r\n      \r\n    }\r\n\r\n   if(dateItemsAdded == 2 and nokiaMode){ \/\/we've just added our thing\r\n          \r\n          if(custom){\r\n            freeCustom += 1;\r\n            totalCustom += 1;\r\n          }\r\n          custom = false;\r\n          dateItemsAdded = 0;\r\n          nok = millis();\r\n          cP = 0; \/\/cursor position\r\n          presses = 0;\r\n          finishedItem = false; \/\/this is set to true when we finish inputting the item, we still gotta input the date \r\n          dateItemsAdded = 0; \/\/once this hits 3, we've added everything\r\n          expiryDay = 0;\r\n          expiryMonth = 0;\r\n          currNum = 0;\r\n          buttonWasPressed = false;\r\n          copied = false;\r\n          nokiaMode = false;\r\n      \r\n}\r\n\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project This device keeps track of items in the user&#8217;s refrigerator as well as their expiry dates, displaying items that are going to expire in 3 or fewer&#8230;<\/p>\n","protected":false},"author":183,"featured_media":13062,"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\/s2021\/work\/wp-json\/wp\/v2\/posts\/13037"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/users\/183"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/comments?post=13037"}],"version-history":[{"count":11,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/13037\/revisions"}],"predecessor-version":[{"id":13175,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/13037\/revisions\/13175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/media\/13062"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/media?parent=13037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/categories?post=13037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/tags?post=13037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}