{"id":13850,"date":"2021-10-05T15:06:34","date_gmt":"2021-10-05T19:06:34","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/?p=13850"},"modified":"2021-10-05T15:30:13","modified_gmt":"2021-10-05T19:30:13","slug":"double-transducer-position-to-brightness","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/double-transducer-position-to-brightness\/","title":{"rendered":"Double Transducer: Position to Brightness"},"content":{"rendered":"<p><strong>Project 1: A Double Transducer: Position to Brightness<\/strong><\/p>\n<p>Peter Heo, John Hewitt, Evangeline Mensah-Agyekum<\/p>\n<p><strong>Gallery<\/strong><\/p>\n<div id=\"attachment_13941\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13941\" loading=\"lazy\" class=\"size-full wp-image-13941\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1857-scaled.jpg\" alt=\"\" width=\"2560\" height=\"2560\" \/><p id=\"caption-attachment-13941\" class=\"wp-caption-text\">View of Completed Project<\/p><\/div>\n<div id=\"attachment_13943\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13943\" loading=\"lazy\" class=\"size-full wp-image-13943\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-scaled.jpg\" alt=\"\" width=\"2560\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-300x300.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-1024x1024.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-150x150.jpg 150w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-768x768.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-1536x1536.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-2048x2048.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-88x88.jpg 88w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-973x973.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_1860-508x508.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-13943\" class=\"wp-caption-text\">View of Servo Motor Arm and Round FSR<\/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-13850-1\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/Untitled.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/Untitled.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/Untitled.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-13881 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0619-scaled-e1633294667290-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<p>&nbsp;<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13850-2\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/project1-1.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/project1-1.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/project1-1.mp4<\/a><\/video><\/div>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-14112 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_9267-min-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13850-3\" width=\"620\" height=\"349\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8425-1.mp4?_=3\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8425-1.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_8425-1.mp4<\/a><\/video><\/div>\n<p><strong>Progress Images<\/strong><\/p>\n<div id=\"attachment_13852\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13852\" loading=\"lazy\" class=\"size-full wp-image-13852\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1831-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-13852\" class=\"wp-caption-text\">Initial design for pressure actuation onto round FSR. Use of a shorter arm compared to final project.<\/p><\/div>\n<div id=\"attachment_13853\" style=\"width: 1930px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13853\" loading=\"lazy\" class=\"size-full wp-image-13853\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-scaled.jpg\" alt=\"\" width=\"1920\" height=\"2560\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/09\/IMG_1830-508x677.jpg 508w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><p id=\"caption-attachment-13853\" class=\"wp-caption-text\">Second version of pressure actuation using servo motor. Used a sort of piston to press down on the round FSR; however, it was finicky and not very stable.<\/p><\/div>\n<div id=\"attachment_13899\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13899\" loading=\"lazy\" class=\"size-full wp-image-13899\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0272-1-scaled-e1633294916685-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-13899\" class=\"wp-caption-text\">I had everything ready to be soldered, but I didn&#8217;t realize the wires weren&#8217;t going to be long enough<\/p><\/div>\n<div id=\"attachment_13880\" style=\"width: 2570px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-13880\" loading=\"lazy\" class=\"size-full wp-image-13880\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/IMG_0618-scaled-e1633295031492-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-13880\" class=\"wp-caption-text\">my broken FSR<\/p><\/div>\n<p><strong>Discussion<\/strong><\/p>\n<p>In terms of difficulty, the brainstorming was one of the more easier parts, as we were able to quickly come up with what we wanted for our middle step to be. However, what was more difficult were the more specific mechanics of the middle step, as we were initially unsure of how to convert slide position into pressure. We started with a couple of ideas but we were able to narrow it down to an arm that would press down on the sensor. Peter tried to come up with a piston that would press and lift a weight onto the round FSR, and a sort of linear actuator that would press against a vertically placed FSR sensor, but both of these proved to be unwieldy and unreliable. We eventually settled on using a straw attached to a lever (servo arm) with enough flexibility to bend when pressed against the FSR.<\/p>\n<p>There were also a couple of challenges along the way, as the code proved to be one source of difficulty. The motor would jitter and stutter periodically, making the servo arm unreliable in pressing down on the FSR sensor. The initial approach to this problem was try to smooth out the values, as we thought it was the potentiometer sending jumpy values, but we learned that it was actually timer collisions between the servo motor and the Neopixel LED ring causing the servo motor to jitter. From this, we learned that sometimes it is not the main user code that is unreliable, but the type of libraries and mechanical components we use.<\/p>\n<p>It was also interesting to calibrate the sensors to not only work with each other, but fit into a 1-100 range on the lcd. It took some finessing, but as we messed around with the values it began to feel more intuitive.<\/p>\n<p>Both Evangeline and Peter experienced a specific wiring issue with the potentiometer, where they switched up input with ground\/5V wiring, causing a short circuit. However, after learning that the wiring was fixed, this problem was easily addressed. Soldering also proved an interesting step for Peter, as he was unfamiliar with it, and learning how to solder was something he enjoyed learning, albeit a bit nervously. John preemptively soldered up the different parts of the project without realizing the wires were not long enough to reach the opposite ends of the board, and had to re-solder things. John also snapped a round FSR when trying to reposition it, it was interesting to use such a delicate piece. John also learned to what a heatsink was, and would have probably damaged the FSR if he hadn&#8217;t been warned ahead of time.<\/p>\n<p>This project also made us think more spatially, as organization and how components would be physically laid out on the board were also part of the project near the end of putting the whole thing together. However, the straightforwardness of the setup and its processes made it easier to assemble.<\/p>\n<p><strong>Block Diagram and Schematic<\/strong><\/p>\n<p><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/Untitled-Diagram.drawio.svg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-13909\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-content\/uploads\/2021\/10\/Untitled-Diagram.drawio.svg\" alt=\"\" width=\"867\" height=\"352\" \/><\/a><\/p>\n<p><strong>Code<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/\/Project: Double Transducer (Position to Brightness)\r\n\/\/Peter Heo\r\n\/\/John Hewitt\r\n\/\/Evangeline Mensah-Agyekum\r\n\r\n\/\/The code below allows for the user to control a slide potentiometer, which then controls a servo motor.\r\n\/\/The slide potentiometer readings are converted to a servo motor angle.\r\n\/\/Said servo motor exerts pressure onto a round FSR through the use a physical arm.\r\n\/\/The round FSR readings are then converted to a certain degree of brightness for an Neopixel LED ring.\r\n\/\/All the input and output values of the mechanisms aforementioned are displayed onto an LCD screen...\r\n\/\/...all mapped to a range of 0-99.\r\n\r\n\/\/Pins                    Mode                    Description\r\n\/\/A0                      Input                   Slide potentiometer readings\r\n\/\/A3                      Input                   Round FSR readings\r\n\/\/6                       Output                  LED Ring\r\n\/\/10                      Output                  Servo motor\r\n\r\n\/\/Library and implementation for the Neopixel servo motor object:\r\n\/\/https:\/\/learn.adafruit.com\/neopixels-and-servos\/the-ticoservo-library\r\n\r\n#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n#include &lt;Adafruit_TiCoServo.h&gt;\r\n#include &lt;Adafruit_NeoPixel.h&gt;\r\n\r\n\/\/Intitialize pin for LED ring and the number of lights on said LED ring, as well as the LED object.\r\n#define PIN  6\r\n#define NUMPIXELS  16\r\nAdafruit_NeoPixel light = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\r\n\r\n\/\/Initialize pins for the slide potentiometer, the round FSR, and the servo motor, as well as the LCD screen object.\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\nconst int SLIDEPIN = A0;\r\nconst int PRESSUREPIN = A3;\r\nconst int SERVOPIN = 10;\r\n\r\n\/\/Initialize the time between display updates, and the timer itself.\r\nconst int LCDUPDATETIME = 250;\r\nlong prevDisplayTime = 0;\r\n\r\nAdafruit_TiCoServo servoMotor;\r\n\r\nvoid setup() {\r\n  \/\/Set up pins for inputs and outputs:\r\n  \/\/Slide potentiometer...\r\n  \/\/...Servo motor...\r\n  \/\/...and Round FSR sensor.\r\n  pinMode(SLIDEPIN, INPUT);\r\n  servoMotor.attach(SERVOPIN);\r\n  pinMode(PRESSUREPIN, INPUT);\r\n\r\n  \/\/Set up LCD display.\r\n  screen.init();\r\n  screen.backlight();\r\n  screen.display();\r\n\r\n  \/\/Set up light.\r\n  light.begin();\r\n  light.setBrightness(0);\r\n  light.show();\r\n\r\n  \/\/Open the serial communication port to talk back to the computer.\r\n  Serial.begin(9600);\r\n}\r\n\r\nvoid loop() {\r\n\r\n  \/\/Look at current time.\r\n  long currentTime = millis();\r\n\r\n  \/\/Initialize slide potentiometer value.\r\n  int slideVal = analogRead(SLIDEPIN);\r\n\r\n  \/\/Range should be about 11 degrees.\r\n\r\n  \/\/Set servo motor angle proportional to slide pot value.\r\n  int servoVal = map(slideVal, 0, 1023, 142, 156);\r\n  servoMotor.write(servoVal);\r\n\r\n\r\n  \/\/Read pressure value from FSR sensor.\r\n  int pressureVal = analogRead(PRESSUREPIN);\r\n\r\n  \/\/Set brightness of LED ring proportional to pressure value.\r\n  int brightnessVal = map(pressureVal, 0, 410, 0, 255);\r\n  light.setBrightness(brightnessVal);\r\n\r\n  \/\/Set color of all LEDs on the LED ring to green.\r\n  for (int i  = 0; i &lt; NUMPIXELS; i++) {\r\n    \/\/Set color of all LEDs on the LED ring to green.\r\n    light.setPixelColor(i, light.Color(128, 150, 128));\r\n  }\r\n  light.show();\r\n\r\n  \/\/Update LCD display every 250 milliseconds.\r\n  if (currentTime - prevDisplayTime &gt;= LCDUPDATETIME) {\r\n    screen.clear();\r\n\r\n    \/\/Print slide values on a range of 0-99 on LCD display.\r\n    int slideDisplayVal = map(slideVal, 1023, 0, 0, 99);\r\n    screen.home();\r\n    screen.print(\"i:\");\r\n    screen.print(slideDisplayVal);\r\n\r\n    \/\/Print servo motor value on a range of 0-99 on LCD display.\r\n    int servoDisplayVal = map(servoVal, 142, 156, 99, 0);\r\n    screen.setCursor(6, 0);\r\n    screen.print(\"m:\");\r\n    screen.print(servoDisplayVal);\r\n\r\n    \/\/Print pressure values on a range of 0-99 on LCD display.\r\n    int pressureDisplayVal = map(pressureVal, 0, 410, 0, 99);\r\n    screen.setCursor(8, 1);\r\n    screen.print(pressureDisplayVal);\r\n\r\n    \/\/Print brightness values on a range of 0-99 on LCD display.\r\n    int brightnessDisplayVal = map(brightnessVal, 0, 255, 0, 99);\r\n    screen.setCursor(12, 1);\r\n    screen.print(\"o:\");\r\n    screen.print(brightnessDisplayVal);\r\n\r\n    prevDisplayTime = currentTime;\r\n\r\n  }\r\n\r\n\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project 1: A Double Transducer: Position to Brightness Peter Heo, John Hewitt, Evangeline Mensah-Agyekum Gallery &nbsp; &nbsp; Progress Images Discussion In terms of difficulty, the brainstorming was one&#8230;<\/p>\n","protected":false},"author":193,"featured_media":13878,"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\/f2021\/work\/wp-json\/wp\/v2\/posts\/13850"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/users\/193"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/comments?post=13850"}],"version-history":[{"count":16,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/13850\/revisions"}],"predecessor-version":[{"id":14150,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/posts\/13850\/revisions\/14150"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/media\/13878"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/media?parent=13850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/categories?post=13850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2021\/work\/wp-json\/wp\/v2\/tags?post=13850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}