{"id":15009,"date":"2022-02-16T00:25:24","date_gmt":"2022-02-16T05:25:24","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/?p=15009"},"modified":"2022-02-16T08:34:18","modified_gmt":"2022-02-16T13:34:18","slug":"double-transducer-flight-of-the-bumblebeep","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/double-transducer-flight-of-the-bumblebeep\/","title":{"rendered":"Double Transducer: Flight of the Bumblebeep"},"content":{"rendered":"<p>60223 Project 1 &#8211; David Wu and Jiaying (Vina) Wei<\/p>\n<p><strong>Double Transducer: Flight of the Bumblebeep<\/strong><\/p>\n<p>This double transducer takes in a rotational input of 10-80 degrees, and outputs a pitch from 200-2000 Hz. It goes through a middle step of LED brightness, and detects this brightness with a photoresistor.<\/p>\n<p><strong>Final Project Photos<\/strong><\/p>\n<div id=\"attachment_15128\" style=\"width: 2010px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15128\" loading=\"lazy\" class=\"wp-image-15128 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1.jpg\" alt=\"\" width=\"2000\" height=\"1500\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1.jpg 2000w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Webp.net-resizeimage-1-508x381.jpg 508w\" sizes=\"(max-width: 2000px) 100vw, 2000px\" \/><p id=\"caption-attachment-15128\" class=\"wp-caption-text\">David&#8217;s Final Version. It contains no restrictions on the input range.<\/p><\/div>\n<div id=\"attachment_15133\" style=\"width: 1290px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15133\" loading=\"lazy\" class=\"wp-image-15133 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo.jpg\" alt=\"\" width=\"1280\" height=\"1477\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo.jpg 1280w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo-260x300.jpg 260w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo-887x1024.jpg 887w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo-768x886.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo-973x1123.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/doument-photo-508x586.jpg 508w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><p id=\"caption-attachment-15133\" class=\"wp-caption-text\">Vina&#8217;s Final Version. It is more optimized for a certain 70 degree range.<\/p><\/div>\n<p><strong>Detailed Component Images<\/strong><\/p>\n<div id=\"attachment_15130\" style=\"width: 2010px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15130\" loading=\"lazy\" class=\"wp-image-15130 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer.jpg\" alt=\"\" width=\"2000\" height=\"1500\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer.jpg 2000w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Potentiometer-508x381.jpg 508w\" sizes=\"(max-width: 2000px) 100vw, 2000px\" \/><p id=\"caption-attachment-15130\" class=\"wp-caption-text\">Input Area. A popsicle stick wedged in a potentiometer served to measure a change in angle from the input.<\/p><\/div>\n<div id=\"attachment_15132\" style=\"width: 2010px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15132\" loading=\"lazy\" class=\"wp-image-15132 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step.jpg\" alt=\"\" width=\"2000\" height=\"1500\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step.jpg 2000w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Middle-Step-508x381.jpg 508w\" sizes=\"(max-width: 2000px) 100vw, 2000px\" \/><p id=\"caption-attachment-15132\" class=\"wp-caption-text\">Middle Step Area. A LED and a photoresistor are soldered together, and bent to face each other for maximum light detection.<\/p><\/div>\n<div id=\"attachment_15131\" style=\"width: 2010px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15131\" loading=\"lazy\" class=\"wp-image-15131 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer.jpg\" alt=\"\" width=\"2000\" height=\"1500\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer.jpg 2000w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Buzzer-508x381.jpg 508w\" sizes=\"(max-width: 2000px) 100vw, 2000px\" \/><p id=\"caption-attachment-15131\" class=\"wp-caption-text\">Output Area. A piezo electric buzzer emits a variable pitch depending on the output signal.<\/p><\/div>\n<p><strong>Video Demonstrations<\/strong><\/p>\n<p>David&#8217;s Version:<\/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-15009-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\/02\/david-video_YGHBdkDw.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/david-video_YGHBdkDw.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/david-video_YGHBdkDw.mp4<\/a><\/video><\/div>\n<p>Vina&#8217;s Version:<\/p>\n<div style=\"width: 568px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-15009-2\" width=\"568\" height=\"320\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/video-documentation.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/video-documentation.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/video-documentation.mp4<\/a><\/video><\/div>\n<p><strong>Simple Narrative Description<\/strong><\/p>\n<p><span style=\"font-weight: 400\">The device takes in something turning and puts out a noise from a speaker. A popsicle stick can be turned around. As it turns towards the right, a blue light glows brighter, which is detected and converted into a higher pitch. As it turns left, the blue light becomes dimmer, and a lower pitch is played.<\/span><\/p>\n<p><strong>Progress Images<\/strong><\/p>\n<div id=\"attachment_15135\" style=\"width: 2010px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15135\" loading=\"lazy\" class=\"wp-image-15135 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1.jpg\" alt=\"\" width=\"2000\" height=\"1500\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1.jpg 2000w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-1-508x381.jpg 508w\" sizes=\"(max-width: 2000px) 100vw, 2000px\" \/><p id=\"caption-attachment-15135\" class=\"wp-caption-text\">David Progress Image 1. This was the discussion and problem-solving behind the concern of inverted input ranges when linking to other devices.<\/p><\/div>\n<div id=\"attachment_15134\" style=\"width: 2010px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15134\" loading=\"lazy\" class=\"wp-image-15134 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2.jpg\" alt=\"\" width=\"2000\" height=\"1500\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2.jpg 2000w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/David-Progress-Image-2-508x381.jpg 508w\" sizes=\"(max-width: 2000px) 100vw, 2000px\" \/><p id=\"caption-attachment-15134\" class=\"wp-caption-text\">David Progress Image 2. Everything is wired up, and placement is being played around with.<\/p><\/div>\n<div id=\"attachment_15136\" style=\"width: 1289px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15136\" loading=\"lazy\" class=\"wp-image-15136 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-rotated.jpg\" alt=\"\" width=\"1279\" height=\"1706\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-rotated.jpg 1279w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-973x1298.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/close-shot-508x678.jpg 508w\" sizes=\"(max-width: 1279px) 100vw, 1279px\" \/><p id=\"caption-attachment-15136\" class=\"wp-caption-text\">Vina Progress Image 1. This was initial circuit design to test if the input worked- the LED has not been bent to face the photoresistor yet.<\/p><\/div>\n<div id=\"attachment_15137\" style=\"width: 1716px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15137\" loading=\"lazy\" class=\"wp-image-15137 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard.jpg\" alt=\"\" width=\"1706\" height=\"1279\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard.jpg 1706w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard-973x729.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/detailed-progress-photo-on-breadboard-508x381.jpg 508w\" sizes=\"(max-width: 1706px) 100vw, 1706px\" \/><p id=\"caption-attachment-15137\" class=\"wp-caption-text\">Vina Progress Image 2. Everything, from input to output, is placed on a single breadboard to test if the code would work.<\/p><\/div>\n<p><strong>Discussion and Reflection<\/strong><\/p>\n<p><span style=\"font-weight: 400\">In general, the project was relatively straightforward. The transmission from the input to the output turned out rather smooth, and most connections were through the Arduino (for example, from initial input to middle input, and from middle output to final output), making potential mechanical errors to be nearly none. As such, most struggles ended up during the programming stage, particularly the mapping of sensory input\/outputs.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Mapping sensory inputs\/outputs was crucial for trying to maintain a good LCD display from 0-99, but also as accurate a transmission of signals as well. However, it proved to be challenging because of inconsistency. For some strange reasons, the photoresistor used to detect the LED brightness seemed to almost recalibrate itself when the device was in use- causing values to go haywire and the mapping to shoot past 0 or 99. It was also affected by environmental light, a factor that was not particularly noticed until the device was used outside of the worktable it was created at (the calibration so finely made was then incorrect). In retrospect, it would have been smart to build a black box for the middle step, which would help to standardize calibration (and perhaps eased the inconsistencies). While this had been an initial thought, it had been disregarded, since bending the photoresistor and LED to face each other seemed to be enough for the signal to transmit. While not entirely wrong in broad considerations, it was incorrect when considering finer details. In the end, to resolve this issue, we used some conditional statements to bound the value to 0-99, and using a lot of calibrating, the device was nearly perfectly mapped, with the display showing from about 2-99.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Another trouble was during consideration of how the device would eventually be linked to the other devices. While technically outside the required scope of the project, it was still a consideration, mostly for courtesy and being a team player. The trouble was that while our designated input was from 10 to 80 degrees, this range of 70 degrees would differ due to a mirroring issue. Our input would be in a counterclockwise direction, like a usual Cartesian coordinate system, but the previous team\u2019s output, should they approach the same intuitive counterclockwise direction, would be mirrored- they would be our input\u2019s 170 to 100 degrees. As such, should we strictly map our input to how we viewed it, it would be completely useless when attached to the previous team. Thus, we created two devices- one of which was more finely tuned to 10 to 80 degrees, which would have the most accurate standards for the individual project grading; one of which was mapped to the entire range, so that the previous team\u2019s input could be taken in, regardless of which direction and which range they ended up using. This allowed us to tackle both challenges at the same time, at the expense of writing two slightly different programs. Mechanically, they were still identical.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Other than these struggles, the project proved to be an exciting test and learning opportunity for the sensors and materials available to us. We discovered many things amidst our adventures: Arduino functions, photoresistors, different blades to whittle popsicle sticks- even the fact that a certain piezo buzzer sounded like \u201cFlight of the Bumblebee\u201d was an unexpected, but fun way to obtain the name of our project. All in all, while the process did not go as smoothly as it could have, the end result worked splendidly, and we are very proud <\/span><span style=\"font-weight: 400\">of that.<\/span><\/p>\n<p><strong>Functional Block Diagram and Schematic<\/strong><\/p>\n<p><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Functional-Block-Diagram-and-schematic.drawio-1.svg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-15146\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Functional-Block-Diagram-and-schematic.drawio-1.svg\" alt=\"\" width=\"1379\" height=\"1247\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Project Code (David&#8217;s Version)<\/strong><\/p>\n<p>This code is optimized to have the input be the entirety of the potentiometer range.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/* Project Title: Flight of the Bumblebeep\r\n * Creators: David Wu and Jiaying (Vina) Wei\r\n * \r\n * This code takes in the input of a potentiometer turning, and maps \r\n * it to output the brightness of an LED. It then reads in the value \r\n * of a photoresistor, which should be reading the aforementioned LED, \r\n * and maps it to output the pitch of a piezo buzzer. The four steps\r\n * are all mapped to 0-99 and displayed on a LCD display.\r\n * \r\n * Pin Mapping:\r\n * Potentiometer : A0\r\n * Photoresistor : A1\r\n * LED           : 5\r\n * Piezo Buzzer  : 6\r\n * LCD SDA\/SCL   : SDA\/SCL       : \r\n * \r\n * Credit to CMU 60-223 Professor Zacharias's code for the LCD Display\r\n *\/\r\n\r\n#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n\r\n\r\nconst int POTPIN = A0; \/\/ potentiometer intput\r\nconst int PHOTOPIN = A1;\/\/ photoresistor input\r\nconst int LEDPIN = 5; \/\/ LED output\r\nconst int SPEAKPIN = 6; \/\/ speaker\/buzzer output\r\nunsigned long lastDispTime = 0; \/\/ to stop LCD flickering\r\n\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\n\r\nvoid setup() {\r\n  pinMode(POTPIN,INPUT);\r\n  pinMode(LEDPIN,OUTPUT);\r\n  pinMode(PHOTOPIN,INPUT);\r\n  pinMode(SPEAKPIN, OUTPUT);\r\n  Serial.begin(9600);\r\n\r\n  \r\n  \/\/ display code\r\n  \/\/ initialize the screen and backlight\r\n  screen.init();\r\n  screen.backlight();\r\n\r\n  \/\/ initial variable display\r\n  screen.home();\r\n  screen.print(\"i:\"); \/\/ potentiometer\r\n  screen.setCursor(6, 0);\r\n  screen.print(\"m:\"); \/\/ LED brightness\r\n  screen.setCursor(8, 1);\r\n  screen.print(\"\"); \/\/ displayed brightness\r\n  screen.setCursor(12, 1);\r\n  screen.print(\"o:\"); \/\/ pitch\r\n}\r\n\r\nvoid loop() {\r\n  \/\/ read potentiometer with popsicle stick\r\n  int potVal = analogRead(POTPIN);\r\n  \r\n  \/\/ convert potentiometer to LED brightness \r\n  int LEDBright = map(potVal,0,1000,0,250);\r\n  analogWrite(LEDPIN,LEDBright);\r\n\r\n  \/\/ detect the brightness using photoresistor\r\n  int detectBright = analogRead(PHOTOPIN);\r\n\r\n  \/\/ convert detected brightness to pitch\r\n  int pitch = map(detectBright,43,270,200,2000);\r\n  tone(SPEAKPIN, pitch);\r\n\r\n  \/\/ display code\r\n  \/\/ change display 8 times a second\r\n  if (millis() - lastDispTime &gt;= 125) {\r\n    \/\/ adjusting values for display purposes\r\n    int potValAdj = map(potVal, 100, 1022, 0, 99);\r\n    if (potValAdj &lt; 0) potValAdj = 0;\r\n    if (potValAdj &gt; 99) potValAdj = 99;\r\n    \r\n    int LEDBrightAdj = map(LEDBright, 10, 255, 0, 99);\r\n    if (LEDBrightAdj &lt; 0) LEDBrightAdj = 0;\r\n    if (LEDBrightAdj &gt; 99) LEDBrightAdj = 99;\r\n    \r\n    int detectBrightAdj = map(detectBright, 230, 70, 0, 99);\r\n    if (detectBrightAdj &lt; 0) detectBrightAdj = 0;\r\n    if (detectBrightAdj &gt; 99) detectBrightAdj = 99;\r\n    \r\n    int pitchAdj = map(pitch, 1700, 500, 0, 99);\r\n    if (pitchAdj &lt; 0) pitchAdj = 0;\r\n    if (pitchAdj &gt; 99) pitchAdj = 99;\r\n    \r\n    \/\/ display formatting\r\n    screen.home();\r\n    screen.print(\"i:\"); \/\/ potentiometer\r\n    screen.print(potValAdj);\r\n    screen.setCursor(6, 0);\r\n    screen.print(\"m:\"); \/\/ LED brightness\r\n    screen.print(LEDBrightAdj);\r\n    screen.setCursor(8, 1);\r\n    screen.print(detectBrightAdj); \/\/ displayed brightness\r\n    screen.setCursor(12, 1);\r\n    screen.print(\"o:\"); \/\/ pitch\r\n    screen.print(pitchAdj);\r\n    lastDispTime = millis();\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>60223 Project 1 &#8211; David Wu and Jiaying (Vina) Wei Double Transducer: Flight of the Bumblebeep This double transducer takes in a rotational input of 10-80 degrees, and&#8230;<\/p>\n","protected":false},"author":209,"featured_media":15128,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[86],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15009"}],"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\/209"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/comments?post=15009"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15009\/revisions"}],"predecessor-version":[{"id":15152,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15009\/revisions\/15152"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/media\/15128"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/media?parent=15009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/categories?post=15009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/tags?post=15009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}