{"id":15375,"date":"2022-03-16T00:49:45","date_gmt":"2022-03-16T04:49:45","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/?p=15375"},"modified":"2022-03-16T00:49:45","modified_gmt":"2022-03-16T04:49:45","slug":"lipstick-container","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/lipstick-container\/","title":{"rendered":"Lipstick Container"},"content":{"rendered":"<p>Do you have the trouble of having too many lipsticks and not knowing which one to use? Try this lipstick container! It can pick out your lucky color of the day for you!<\/p>\n<h3>Overall Photos<\/h3>\n<div id=\"attachment_15465\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15465\" loading=\"lazy\" class=\"wp-image-15465 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1707\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-300x200.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-1024x683.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-768x512.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-1536x1024.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-2048x1365.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-973x649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/1-508x339.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15465\" class=\"wp-caption-text\">the overall image of the lipstick container<\/p><\/div>\n<h3>Detailed Photos<\/h3>\n<div id=\"attachment_15466\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15466\" loading=\"lazy\" class=\"wp-image-15466 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1707\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-300x200.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-1024x683.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-768x512.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-1536x1024.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-2048x1365.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-973x649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/2-508x339.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15466\" class=\"wp-caption-text\">what the bottom of the container looks like<\/p><\/div>\n<div id=\"attachment_15468\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15468\" loading=\"lazy\" class=\"wp-image-15468 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1707\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-300x200.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-1024x683.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-768x512.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-1536x1024.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-2048x1365.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-973x649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/4-508x339.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15468\" class=\"wp-caption-text\">LCD display first version<\/p><\/div>\n<div id=\"attachment_15470\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15470\" loading=\"lazy\" class=\"wp-image-15470 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1707\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-300x200.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-1024x683.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-768x512.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-1536x1024.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-2048x1365.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-973x649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/6-508x339.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15470\" class=\"wp-caption-text\">LCD display second version<\/p><\/div>\n<div id=\"attachment_15471\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15471\" loading=\"lazy\" class=\"wp-image-15471 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1707\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-300x200.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-1024x683.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-768x512.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-1536x1024.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-2048x1365.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-973x649.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/7-508x339.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15471\" class=\"wp-caption-text\">separation of the electrical part and the container<\/p><\/div>\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-15375-1\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/video.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/video.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/video.mp4<\/a><\/video><\/div>\n<h3>Process Images and Review<\/h3>\n<h5>First Decision Point<\/h5>\n<p>At first, besides randomly choosing the lipstick, I designed another feature for the container. Since it was easy for me to mess up my table after make-up, I wish the container could remind me of putting the lipstick back in its place after using it. Therefore, it would beep after 2 minutes if the room of the container was still empty. I found that if I wanted to make it, it needed much more space for the wiring part which made the container huge. Meanwhile, this feature was not as attractive as the random-choosing one, so I finally canceled it.<\/p>\n<h5>Second Decision Point<\/h5>\n<p>Since I had to connect 12 LED lights, one LCD display, and one ADXL335 analog accelerometer, I wiring part was very complicated and hard to follow. Therefore at that time, I decided to do the soldering to make it look logical and clear.<\/p>\n<div id=\"attachment_15418\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15418\" loading=\"lazy\" class=\"wp-image-15418 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering1-1-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-15418\" class=\"wp-caption-text\">wiring on normal breadboards<\/p><\/div>\n<p>Honestly, I tried to do the soldering and finished all about it. But the results were not satisfying which made me realize soldering is not suitable for all the situations. Because there was a certain distance between each LED, it was impossible to reduce the wiring part through soldering. Also, since the wiring part is at the bottom of the container, some wires were bent which made them easy to be broken. If it was broken, I have to do the soldering again (I did it almost 5-6 times). So finally I gave up the soldering idea and just used normal breadboards to connect them.<\/p>\n<div id=\"attachment_15419\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15419\" loading=\"lazy\" class=\"wp-image-15419 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/soldering2-1-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-15419\" class=\"wp-caption-text\">attempt of soldering<\/p><\/div>\n<h6>Process Highlights<\/h6>\n<div id=\"attachment_15416\" style=\"width: 1090px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15416\" loading=\"lazy\" class=\"wp-image-15416 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2.jpg\" alt=\"\" width=\"1080\" height=\"1062\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2.jpg 1080w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2-300x295.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2-1024x1007.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2-768x755.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2-88x88.jpg 88w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2-973x957.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/draft_project2-508x500.jpg 508w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/><p id=\"caption-attachment-15416\" class=\"wp-caption-text\">draft of the design<\/p><\/div>\n<div id=\"attachment_15417\" style=\"width: 1418px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15417\" loading=\"lazy\" class=\"wp-image-15417 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1.jpg\" alt=\"\" width=\"1408\" height=\"551\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1.jpg 1408w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1-300x117.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1-1024x401.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1-768x301.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1-973x381.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/MODEL-1-508x199.jpg 508w\" sizes=\"(max-width: 1408px) 100vw, 1408px\" \/><p id=\"caption-attachment-15417\" class=\"wp-caption-text\">the model in Rhino<\/p><\/div>\n<div id=\"attachment_15478\" style=\"width: 510px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15478\" loading=\"lazy\" class=\"wp-image-15478 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/lipstick-container-2ps.gif\" alt=\"\" width=\"500\" height=\"281\" \/><p id=\"caption-attachment-15478\" class=\"wp-caption-text\">first time to make lights work successfully on breadboards<\/p><\/div>\n<h4>Discussion<\/h4>\n<p>Overall, I am really satisfied with what I created for this project. It can successfully solve my trouble of choosing which lipstick to use in the morning and make my day starts with surprise and fun lol. As an architecture student, it was not a hard part for me to build a model in both digital and physical ways and do laser cutting. The most difficult thing for me is writing the code to make my device work. It was my first time writing the code independently which made me get a deeper understanding of the logic of each step. Thanks to Zach, he explained how to turn the lights on in order and taught me how to do the random choosing process. He was so patient and encouraged me a lot which made me become confident with learning the coding language. Also, I got a better understanding of the loop function which made the LCD display show the information incorrect time.<\/p>\n<p>I really enjoyed the discussion about the prototype with my classmates. They were so kind that gave me a bunch of encouragement as well as a lot of suggestions. For instance, someone suggested that I could use some tools to make the choice of lipstick based on the eye shadow I wear. I did think it is a good idea, a sensor can detect the color of eye shadow which could bring about a specific lipstick matching with all the makeup look. But what I want for the lipstick container is a totally surprising thing, you would not know any hints about which one to use before you tap the screen. A boy told me that I could add a screen to the container with some warm-hearted words on it. This suggestion was super useful so I add \u2018You Look so Nice Today\u2019 when finishing the choosing process.<\/p>\n<p>If I had more time, I would add a power switch to the container to make it work only when I need it. Also, I would think about developing another type of container like the girl\u2019s idea about matching with eye shadow. I truly think it will be cool and get in touch with many other interesting sensors and improve my coding abilities as well. Due to the limited time and energy, I could not complete all the good ideas so perfectly. I am really looking forward to the next project! I love new challenges and I believe, the new project will bring me a lot of inspiring thoughts and much more improvement about my abilities.<\/p>\n<h4>Technical information<\/h4>\n<h6>Block Diagram<\/h6>\n<h6><img loading=\"lazy\" class=\"alignnone wp-image-15390 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-1.jpg\" alt=\"\" width=\"781\" height=\"340\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-1.jpg 781w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-1-300x131.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-1-768x334.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-1-508x221.jpg 508w\" sizes=\"(max-width: 781px) 100vw, 781px\" \/><\/h6>\n<h6>Schematic Diagram<\/h6>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-15391 size-full\" style=\"font-size: 10.72px;font-weight: bold\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-2.jpg\" alt=\"\" width=\"986\" height=\"1019\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-2.jpg 986w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-2-290x300.jpg 290w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-2-768x794.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-2-973x1006.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/03\/Untitled-Diagram-Page-2-508x525.jpg 508w\" sizes=\"(max-width: 986px) 100vw, 986px\" \/><\/p>\n<h6>Code<\/h6>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/*  60-223 Assistive Device\r\n    Yongwen Dai\r\n    Description: This code enables the movement of ADXL335 analog accelerometer to start the lights on. All the 12 lights will be on in order at the beginning and finally only one of them will be chosen randomly to be on. The LCD display shows 2 different information at beginning and end of choosing.\r\n    Pin mapping:\r\n    Arduino pin | type   | description\r\n    ------------|--------|-------------\r\n         A0       input     X axis of ADXL335 analog accelerometer\r\n         A1       input     Y axis of ADXL335 analog accelerometer\r\n         A2       input     Z axis of ADXL335 analog accelerometer\r\n         2        output    LED light 1\r\n         3        output    LED light 2\r\n         4        output    LED light 3\r\n         5        output    LED light 4\r\n         6        output    LED light 5\r\n         7        output    LED light 6\r\n         8        output    LED light 7\r\n         9        output    LED light 8\r\n         10       output    LED light 9\r\n         11       output    LED light 10\r\n         12       output    LED light 11\r\n         13       output    LED light 12\r\n      \r\n    The following sources were consulted to create our code:\r\n    https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/tutorials\/ADXL335\r\n    https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/tutorials\/I2C-lcd\r\n*\/\r\n\r\n\r\n#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n\r\n\/* Creates an LCD display object called \"screen\" with I2C address 0x27\r\n   which is 16 columns wide and 2 rows tall. *\/\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\n\r\n\r\n\/\/pin names\r\nint light1 = 2;\r\nint light2 = 3;\r\nint light3 = 4;\r\nint light4 = 5;\r\nint light5 = 6;\r\nint light6 = 7;\r\nint light7 = 8;\r\nint light8 = 9;\r\nint light9 = 10;\r\nint light10 = 11;\r\nint light11 = 12;\r\nint light12 = 13;\r\n\r\nconst int XPIN = A0;\r\nconst int YPIN = A1;\r\nconst int ZPIN = A2;\r\n\r\nint Y;\r\n\r\n\/\/other variables\r\nint timeShowDecision = 2000;\r\nint timeBlink = 80;\r\n\r\nvoid setup()\r\n{\r\n  \/\/set input ADXL335 pins\r\n  pinMode(XPIN, INPUT);\r\n  pinMode(YPIN, INPUT);\r\n  pinMode(ZPIN, INPUT);\r\n  \/\/set LED output pins\r\n  pinMode(light1, OUTPUT);\r\n  pinMode(light2, OUTPUT);\r\n  pinMode(light3, OUTPUT);\r\n  pinMode(light4, OUTPUT);\r\n  pinMode(light5, OUTPUT);\r\n  pinMode(light6, OUTPUT);\r\n  pinMode(light7, OUTPUT);\r\n  pinMode(light8, OUTPUT);\r\n  pinMode(light9, OUTPUT);\r\n  pinMode(light10, OUTPUT);\r\n  pinMode(light11, OUTPUT);\r\n  pinMode(light12, OUTPUT);\r\n\r\n  \/\/initialize the serial communication:\r\n  Serial.begin(9600);\r\n  \r\n  \/\/set words for LCD screen\r\n    screen.init();\r\n    screen.backlight();\r\n}\r\n\r\nvoid loop()\r\n{\r\n  \/\/LCD display will show some words to encourage you to tap the screen.\r\n  screen.setCursor(2, 0);\r\n  screen.print(\"tap HERE for\");\r\n  screen.setCursor(3, 1);\r\n  screen.print(\"a lipstick\");\r\n  delay(3600);\r\n\r\n  int newX =analogRead(XPIN);  \/\/read from xpin\r\n  delay(50);\r\n  int newY =analogRead(YPIN);  \/\/read from ypin\r\n  delay(50);\r\n  int newZ =analogRead(ZPIN);  \/\/read from zpin\r\n  delay(50);\r\n \r\n  \/\/YPIN will change if you tap the screen to make the ADXL335 analog accelerometer move, \r\n  then all the 12 lights will be on in order.\r\n \r\n  if(newY - Y &gt; 2){\r\n    digitalWrite(light1,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light1,LOW);\r\n    delay(timeBlink);\r\n \r\n    digitalWrite(light2,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light2,LOW);\r\n    delay(timeBlink);\r\n \r\n    digitalWrite(light3,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light3,LOW);\r\n    delay(timeBlink);\r\n \r\n    digitalWrite(light4,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light4,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light5,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light5,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light6,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light6,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light7,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light7,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light8,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light8,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light9,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light9,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light10,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light10,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light11,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light11,LOW);\r\n    delay(timeBlink);\r\n\r\n    digitalWrite(light12,HIGH);\r\n    delay(timeBlink);\r\n    digitalWrite(light12,LOW);\r\n    delay(timeBlink);\r\n\r\n    \/\/Finally the system will use Random function to make only on light be on.\r\n    digitalWrite(random(2,14),HIGH);\r\n    delay(timeShowDecision);\r\n    \r\n    \/\/LCD display will change the words after the accomplishment of choosing.\r\n    screen.clear();\r\n    screen.setCursor(2, 0);\r\n    screen.print(\"You Look so\");\r\n    screen.setCursor(2, 1);\r\n    screen.print(\"Nice  Today\");\r\n    delay(10000);\r\n    screen.clear();  \r\n  } \r\n \r\n  else {\r\n    \/\/ Reset all output pins\r\n    digitalWrite(light1, LOW);\r\n    digitalWrite(light2, LOW);\r\n    digitalWrite(light3, LOW);\r\n    digitalWrite(light4, LOW);\r\n    digitalWrite(light5, LOW);\r\n    digitalWrite(light6, LOW);\r\n    digitalWrite(light7, LOW);\r\n    digitalWrite(light8, LOW);\r\n    digitalWrite(light9, LOW);\r\n    digitalWrite(light10, LOW);\r\n    digitalWrite(light11, LOW);\r\n    digitalWrite(light12, LOW);\r\n  }    \r\n    Y = newY;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you have the trouble of having too many lipsticks and not knowing which one to use? Try this lipstick container! It can pick out your lucky color&#8230;<\/p>\n","protected":false},"author":212,"featured_media":15467,"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\/s2022\/work\/wp-json\/wp\/v2\/posts\/15375"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/users\/212"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/comments?post=15375"}],"version-history":[{"count":19,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15375\/revisions"}],"predecessor-version":[{"id":15505,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15375\/revisions\/15505"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/media\/15467"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/media?parent=15375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/categories?post=15375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/tags?post=15375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}