{"id":17458,"date":"2023-02-15T08:17:43","date_gmt":"2023-02-15T13:17:43","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/?p=17458"},"modified":"2023-02-19T17:15:46","modified_gmt":"2023-02-19T22:15:46","slug":"double-transducer-water-level-to-rotational-speed","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/double-transducer-water-level-to-rotational-speed\/","title":{"rendered":"Double Transducer: Water level to Rotational Speed"},"content":{"rendered":"<p>Peiran Ge, Quinten Staples.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_17463\" style=\"width: 859px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17463\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17463\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422.jpeg\" alt=\"\" width=\"849\" height=\"637\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422.jpeg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1542-scaled-e1676442909422-508x381.jpeg 508w\" sizes=\"(max-width: 849px) 100vw, 849px\" \/><p id=\"caption-attachment-17463\" class=\"wp-caption-text\">Top View of Peiran&#8217;s double transducer. Water level (bottom left), rotational speed (top right)<\/p><\/div>\n<div id=\"attachment_17538\" style=\"width: 828px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17538\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17538\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM.png\" alt=\"\u201cImage of Quinten's double transducer\u201d\" width=\"818\" height=\"563\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM.png 2288w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-300x207.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-1024x706.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-768x530.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-1536x1059.png 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-2048x1412.png 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-973x671.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.32.51-PM-508x350.png 508w\" sizes=\"(max-width: 818px) 100vw, 818px\" \/><p id=\"caption-attachment-17538\" class=\"wp-caption-text\">Top View of Quinten&#8217;s double transducer &#8211; Water Level (left), rotational speed (right)<\/p><\/div>\n<div id=\"attachment_17461\" style=\"width: 586px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17461\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17461\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-scaled.jpeg\" alt=\"\" width=\"576\" height=\"768\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-scaled.jpeg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-225x300.jpeg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-768x1024.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-1152x1536.jpeg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-1536x2048.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-973x1297.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1544-508x677.jpeg 508w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><p id=\"caption-attachment-17461\" class=\"wp-caption-text\">Detail on the structure that separates each photoresistor<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_17464\" style=\"width: 664px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17464\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17464\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic.png\" alt=\"\" width=\"654\" height=\"359\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic.png 1890w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic-300x165.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic-1024x562.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic-768x421.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic-1536x843.png 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic-973x534.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/detail-pic-508x279.png 508w\" sizes=\"(max-width: 654px) 100vw, 654px\" \/><p id=\"caption-attachment-17464\" class=\"wp-caption-text\">Combinations of different LED representations.<\/p><\/div>\n<div id=\"attachment_17537\" style=\"width: 642px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17537\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17537\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-4.29.26-PM.png\" alt=\"Image of breadboard with L293D Motor Driver and cables attaching to Arduino and dc motor\" width=\"632\" height=\"828\" \/><p id=\"caption-attachment-17537\" class=\"wp-caption-text\">(Quinten) Image of breadboard with L293D Motor Driver and cables attaching to Arduino and DC Motor<\/p><\/div>\n<p><strong>Final Video:<\/strong><\/p>\n<p>Peiran<\/p>\n<p>&nbsp;<\/p>\n<p>The ultrasonic ranger detects the water level, or distance to the object, which changes how 4 LEDs light up. Photoresistors then sense these light changes, and the Arduino Uno alters the motor&#8217;s rotational speed based on what the photoresistors read.<\/p>\n<p>&nbsp;<\/p>\n<p>Quinten<\/p>\n<p>The ultrasonic ranger works to detect distance and would probably read water levels somewhat well. The ultrasonic ranger is able to drive the 4 LEDs light output. At this point the photoresistors should pick up the light output from the LEDs and drive the DC motor&#8217;s speed. The system works up until the photoresistors and the DC motor.<\/p>\n<p><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_9351.mov\">IMG_9351<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Process:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_17462\" style=\"width: 733px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17462\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17462\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-scaled.jpeg\" alt=\"\" width=\"723\" height=\"284\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-scaled.jpeg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-300x118.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-1024x402.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-768x301.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-1536x603.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-2048x804.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-973x382.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/IMG_1543-508x199.jpeg 508w\" sizes=\"(max-width: 723px) 100vw, 723px\" \/><p id=\"caption-attachment-17462\" class=\"wp-caption-text\">Experimenting with how to best exclude outside lighting for the photo-resistors.<\/p><\/div>\n<div id=\"attachment_17540\" style=\"width: 795px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17540\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17540\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed.png\" alt=\"TinkerCad Model of Double Transducer- Water Level to Rotational Speed\" width=\"785\" height=\"399\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed.png 1470w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed-300x152.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed-1024x520.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed-768x390.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed-973x494.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Double-Transducer-Water-Level-to-Rotational-Speed-508x258.png 508w\" sizes=\"(max-width: 785px) 100vw, 785px\" \/><p id=\"caption-attachment-17540\" class=\"wp-caption-text\">TinkerCad Model of Double Transducer- Water Level to Rotational Speed<\/p><\/div>\n<div id=\"attachment_17542\" style=\"width: 751px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17542\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17542\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Screen-Shot-2023-02-19-at-5.13.13-PM.png\" alt=\"Process Image of Quinten's double transducer. \" width=\"741\" height=\"409\" \/><p id=\"caption-attachment-17542\" class=\"wp-caption-text\">Process Image of Quinten&#8217;s double transducer. Laying out physical components to match TinkerCad diagram<\/p><\/div>\n<p><strong>Discussion:<\/strong><\/p>\n<p>Since our task was to only detect water levels, not manipulate them, the first part of this project was not as challenging. Both of us decided to just place the ultrasonic ranger on the board without worrying about actual water levels. We were also able to visually display the LEDs in a way that&#8217;s easy to understand and distinguish between various levels.<\/p>\n<p>However, there was a lot of debugging, especially with code, and both of our projects didn&#8217;t end up successfully performing the target task. It is a bit disappointing, but overall this has been an extremely eye-opening experience. Getting the middle stage of the double transducer was more difficult than I had expected. Even with the LEDs scaling in brightness to the ultrasonic ranger&#8217;s distance readings, it was hard to get the photoresistors to read and control the motor speed the way we intended. Utilizing online documentation of past projects was a huge help in troubleshooting and figuring out our code and setup.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Diagram and Schematic:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_17466\" style=\"width: 622px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17466\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-17466\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio.png\" alt=\"\" width=\"612\" height=\"645\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio.png 694w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-285x300.png 285w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-508x535.png 508w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><p id=\"caption-attachment-17466\" class=\"wp-caption-text\">Block Diagram<\/p><\/div>\n<div id=\"attachment_17541\" style=\"width: 895px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-17541\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-17541\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio.png\" alt=\"Block Diagram of Quinten's Double Transducer from draw.io\" width=\"885\" height=\"424\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio.png 1181w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio-300x144.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio-1024x491.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio-768x368.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio-973x466.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Project-1-4.drawio-508x243.png 508w\" sizes=\"(max-width: 885px) 100vw, 885px\" \/><p id=\"caption-attachment-17541\" class=\"wp-caption-text\">(Quinten) Block Diagram<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-17467 aligncenter\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-2-e1676444996706.png\" alt=\"\" width=\"617\" height=\"523\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-2-e1676444996706.png 949w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-2-e1676444996706-300x254.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-2-e1676444996706-768x651.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-content\/uploads\/2023\/02\/Copy-of-Project-1-4.drawio-2-e1676444996706-508x431.png 508w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">#include &lt;Servo.h&gt;\r\n#include &lt;NewPing.h&gt;\r\n\r\nconst int trigger = 5; \/\/ultrasonic ranger\r\nconst int echo = 4;\r\nconst int maxDist = 30; \/\/in centimeters\r\nconst int ServoPin = 11; \/\/Motor\r\nconst int Red = 13; \/\/LED pins by color\r\nconst int Yellow = 12;\r\nconst int Blue = 7;\r\nconst int Green = 8;\r\nconst int Redresis = A0; \/\/Photoresistors by color of LED\r\nconst int Yellowresis = A1;\r\nconst int Greenresis = A2;\r\nconst int Blueresis = A3;\r\n  \/\/Global Variables fore pin numbers.\r\n  \/\/Referencing to code structure guide from class website\r\n\r\nServo Motor;\r\nNewPing sonar(trigger, echo, maxDist);\r\n\/\/Referencing tutorial pages from class website\r\n\r\nint Dist,\r\n    Display,\r\n    Brightness,\r\n    Speed;\r\n  \/\/Variables for input\/storing information\r\n\r\nvoid setup() {\r\n  Motor.attach(ServoPin);\r\n  pinMode(Redresis, INPUT);\r\n  pinMode(Yellowresis, INPUT);\r\n  pinMode(Greenresis, INPUT);\r\n  pinMode(Blueresis, INPUT);\r\n  pinMode(Greenresis, INPUT);\r\n  \r\n  pinMode(Red, OUTPUT);\r\n  pinMode(Yellow, OUTPUT);\r\n  pinMode(Green, OUTPUT);\r\n  pinMode(Blue, OUTPUT);  \r\n\r\n  pinMode(Speed,OUTPUT);\r\n  pinMode(ServoPin,OUTPUT);\r\n}\r\n\r\nvoid loop() {\r\n  \/\/detect water level\r\n  delay(50);\r\n  Dist = sonar.ping_cm();\r\n  DisplayLED ();\r\n\r\n\/\/Photoresistor\r\n  Brightness = 0;\r\nint Redval;\r\n  Redval = analogRead(Redresis);\r\n  if (Redval &gt;= 300) {\r\n    Brightness += 1;   \r\n  } \/\/referencing class website for photoresistor\r\n\r\nint Yellowval;\r\n  Yellowval = analogRead(Yellowresis);\r\n  if (Yellowval &gt;= 300) {\r\n    Brightness += 2;   \r\n  }\r\n\r\nint Greenval;\r\n  Greenval = analogRead(Greenresis);\r\n  if (Greenval &gt;= 300) {\r\n    Brightness += 4;   \r\n  }\r\n\r\nint Blueval;\r\n  Blueval = analogRead(Blueresis);\r\n  if (Blueval &gt;= 300) {\r\n    Brightness += 8;   \r\n  }  \r\n  \r\n\/\/motor speed\r\nSpeed = 200\/Brightness;\r\n  Motor.write(0);\r\n  delay(Speed);\r\n  Motor.write(180);\r\n  delay(Speed);\r\n}\r\n\r\nvoid DisplayLED() {\r\nDisplay = Dist\/2;\r\nif (Display%2 == 1){\r\n    digitalWrite(Red, HIGH);  \r\n  } \r\n  \r\nif (Display%4 == 2 || Display%4 == 3){\r\n    digitalWrite(Yellow, HIGH); \r\n  }\r\n\r\nif ((Display-3)%8 &lt;= 4){\r\n    digitalWrite(Green, HIGH);  \r\n  }\r\n\r\nif (Display &gt;= 8){\r\n    digitalWrite(Blue, HIGH);  \r\n  } \r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Peiran Ge, Quinten Staples. &nbsp; &nbsp; Final Video: Peiran &nbsp; The ultrasonic ranger detects the water level, or distance to the object, which changes how 4 LEDs light&#8230;<\/p>\n","protected":false},"author":51,"featured_media":0,"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\/s2023\/work\/wp-json\/wp\/v2\/posts\/17458"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/comments?post=17458"}],"version-history":[{"count":5,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/posts\/17458\/revisions"}],"predecessor-version":[{"id":17543,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/posts\/17458\/revisions\/17543"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/media?parent=17458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/categories?post=17458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2023\/work\/wp-json\/wp\/v2\/tags?post=17458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}