{"id":15077,"date":"2022-02-16T10:00:09","date_gmt":"2022-02-16T15:00:09","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/?p=15077"},"modified":"2022-02-16T10:31:52","modified_gmt":"2022-02-16T15:31:52","slug":"double-transducer-color-to-rotational-position","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/double-transducer-color-to-rotational-position\/","title":{"rendered":"Double Transducer: Color to Rotational Position"},"content":{"rendered":"<p>Photos that show scale:<\/p>\n<div id=\"attachment_15168\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15168\" loading=\"lazy\" class=\"wp-image-15168 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/scale-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15168\" class=\"wp-caption-text\">Zoey&#8217;s scale compared to a quarter dollar<\/p><\/div>\n<p>Jerry &#8216;s scale for a ruler<img loading=\"lazy\" class=\"alignnone size-full wp-image-15166\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/overview-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-15223\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0142-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>Videos:<\/p>\n<p><iframe loading=\"lazy\" title=\"IMG 0141\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/fn4gfgbSgWY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p><iframe loading=\"lazy\" title=\"IMG 0138\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/a_UENg6wzU8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p><strong>Progress images:<\/strong><\/p>\n<div id=\"attachment_15167\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15167\" loading=\"lazy\" class=\"wp-image-15167 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/speaker-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15167\" class=\"wp-caption-text\">A closer view to the speaker<\/p><\/div>\n<div id=\"attachment_15169\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15169\" loading=\"lazy\" class=\"wp-image-15169 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/RGB-sensor-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15169\" class=\"wp-caption-text\">The color sensor is not fixed so we can move it to whatever color we want to detect<\/p><\/div>\n<div id=\"attachment_15170\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15170\" loading=\"lazy\" class=\"wp-image-15170 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/noLCD-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-15170\" class=\"wp-caption-text\">Wiring process<\/p><\/div>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-15216\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0134-1-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>Wiring before the RGB sensor was put in<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-15217\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/IMG-0136-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>Here is the soldered RGB sensor! This is the first time soldering for both of us, and it was very fun!<\/p>\n<p><strong>Simple Narrative Description<\/strong><\/p>\n<p><span style=\"font-weight: 400\">This double transducer is a machine that can read a color, map the color to a sound, and then map the volume of the sound to a rotation angle.<\/span><\/p>\n<div class=\"mceTemp\"><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_15171\" style=\"width: 602px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-15171\" loading=\"lazy\" class=\"wp-image-15171 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/code-process.png\" alt=\"\" width=\"592\" height=\"808\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/code-process.png 592w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/code-process-220x300.png 220w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/code-process-508x693.png 508w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/><p id=\"caption-attachment-15171\" class=\"wp-caption-text\">Coding process<\/p><\/div>\n<p><strong>Discussion<\/strong><\/p>\n<p><span style=\"font-weight: 400\">Something that was quite easy was coming up with the idea. Transducers seem to be quite common in the world around us (even though most transducers are single transducers, or so it seems); we just pulled from transducers that we have seen from the past, and the commonality of volume as a signal mechanism was very helpful in brainstorming ideas. Something that was hard was the process of coding the project. We ran into some issues with the libraries that we were using due to our physical components and the requirements of each component. We had to reach out to the Professor in order to resolve this problem. A tweak that would have changed the direction of this entirely would have been the emphasis on code in the beginning. Our group focused on building first rather than testing little parts, which resulted in us having to debug a massive amount of problems that were all inter-related. In terms of our creative growth, we were able to find useful applications for things that we found in real life. In terms of our technical growth, we were both able to become more familiar with the process of turning an idea into something physical! Next time, we would like to grow more in the efficiency process. We skipped a lot of steps, as well as performed many important steps out of order. As a result, we were less efficient than we could have been. Overall, however, the process was quite fun and interactive. We engaged in several troubleshooting sessions &#8211; first it was establishing the pieces that we needed, as well as the wiring for them. We had to go onto the websites of each piece to understand how the wiring and the code worked. Secondly, as mentioned previously, we had to focus on coding. Since C is pretty nit\u2013picky sometimes, we had to make sure that everything that we were coding was intentional and not full of things that were unnecessary. In the end, our code was quite shorter than the beginning brainstorming session.\u00a0<\/span><\/p>\n<p><strong>Functional Block Diagram<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-15172 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Project-1-functional.png\" alt=\"\" width=\"812\" height=\"521\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Project-1-functional.png 812w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Project-1-functional-300x192.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Project-1-functional-768x493.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/Project-1-functional-508x326.png 508w\" sizes=\"(max-width: 812px) 100vw, 812px\" \/><\/p>\n<p><strong>Schematic Diagram<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-15173\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/new-schematic.png\" alt=\"\" width=\"811\" height=\"523\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/new-schematic.png 811w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/new-schematic-300x193.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/new-schematic-768x495.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-content\/uploads\/2022\/02\/new-schematic-508x328.png 508w\" sizes=\"(max-width: 811px) 100vw, 811px\" \/><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">Double Transducer: Color to Rotational Position\r\n\r\n\/\/ this includes all of the necessary libraries and sub-portions\r\n#include &lt;Wire.h&gt;\r\n#include \"Adafruit_TCS34725.h\"\r\n#include &lt;toneAC.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n\r\n\/\/ the following lines introduce global variables that have a baseline value of 0; this will be adjusted in local code later. \r\nAdafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);\r\nunsigned long lastTime = 0;\r\nunsigned long lastQuarterTime = 0;\r\nfloat red, green, blue=0;\r\nfloat hue=0;\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\nconst int MOTORPIN = 3;\r\nint volume = 0;\r\nint degree = 0;\r\n\r\n#define ENVELOPE A0\r\n#define MIN(a,b) (((a)&lt;(b))?(a):(b))\r\n#define MAX(a,b) (((a)&gt;(b))?(a):(b))\r\n\r\n\/\/A function converting RGB value to Hue \r\nfloat getHue(float red, float green, float blue) {\r\n\r\n  float min = MIN(MIN(red, green), blue);\r\n  float max = MAX(MAX(red, green), blue);\r\n\r\n  if (min == max) {\r\n    return 0;\r\n  }\r\n  float h = 0;\r\n  if (max == red) {\r\n    h = (green - blue) \/ (max - min);\r\n\r\n  } else if (max == green) {\r\n    h = 2 + (blue - red) \/ (max - min);\r\n\r\n  } else {\r\n    h = 4 + (red - green) \/ (max - min);\r\n  }\r\n\r\n  h = h * 60;\r\n  if (h &lt; 0) h = h + 360;\r\n\r\n  return h;\r\n}\r\n\/\/ Code for servo motor without using library \r\nvoid servoWrite(byte servoPin, byte servoDegree) {\r\n  pinMode (servoPin, OUTPUT); \/\/ in case it's not already set\r\n\r\n  const int INTERPULSEDELAY = 20; \/\/ typical delay between servo pulses\r\n\r\n  static unsigned long lastPulseTime;\r\n\r\n  if (millis() - lastPulseTime &gt; INTERPULSEDELAY) {\r\n\r\n    \/\/ turn degree input to pulse length output\r\n    unsigned int pulseWait = map(servoDegree, 0, 180, 544, 2400);\r\n\r\n    \/\/ transmit pulse of specified length\r\n    digitalWrite(servoPin, HIGH);\r\n    delayMicroseconds(pulseWait);\r\n    digitalWrite(servoPin, LOW);\r\n\r\n    \/\/ reset timer\r\n    lastPulseTime = millis();\r\n  }\r\n}\r\n\r\n\r\n\r\nvoid setup() {\r\n  \/\/ set up the LCD's number of columns and rows:\r\n  screen.init();\r\n\r\n  \/\/ turn on the backlight to start\r\n  screen.backlight();\r\n\r\n  \/\/ set cursor to home position, i.e. the upper left corner\r\n  screen.home();\r\n  \r\n  pinMode(MOTORPIN, OUTPUT);\r\n  pinMode(ENVELOPE, INPUT);\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop() {\r\n \r\n\/\/ get hue value of the color\r\n    tcs.getRGB(&amp;red, &amp;green, &amp;blue);\r\n    hue = getHue(red, green, blue);\r\n    int color = map(hue, 0, 360, 0, 10);\r\n\/\/ make speaker to make a sound\r\n    toneAC(440, color, 0, true);\r\n    volume = analogRead(ENVELOPE);\r\n\/\/ mapping the volume signal into the degree signal\r\n    degree = map(volume, 0, 10, 0, 90);\r\n    servoWrite(MOTORPIN, degree);\r\n\r\n\/\/ to display the necessary indicators onto the led\r\n  if (millis() - lastQuarterTime &gt;= 25) {\r\n    screen.setCursor(0, 0);\r\n    screen.print((String)\"i:\" + (int)hue + \"  m:\" + volume);\r\n    screen.setCursor(1, 9);\r\n    screen.print((String)\"     \" + (int)hue + \"  o:\" + degree);\r\n    lastTime = millis();\r\n\r\n  }\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Photos that show scale: Jerry &#8216;s scale for a ruler Videos: Progress images: Wiring before the RGB sensor was put in Here is the soldered RGB sensor! This&#8230;<\/p>\n","protected":false},"author":208,"featured_media":15166,"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\/15077"}],"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\/208"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/comments?post=15077"}],"version-history":[{"count":7,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15077\/revisions"}],"predecessor-version":[{"id":15226,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/posts\/15077\/revisions\/15226"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/media\/15166"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/media?parent=15077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/categories?post=15077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2022\/work\/wp-json\/wp\/v2\/tags?post=15077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}