<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Adin Gilmancohen on Medium]]></title>
        <description><![CDATA[Stories by Adin Gilmancohen on Medium]]></description>
        <link>https://medium.com/@adin_gilmancohen?source=rss-ebf339ee554c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xZp12r8k6MkNNATV</url>
            <title>Stories by Adin Gilmancohen on Medium</title>
            <link>https://medium.com/@adin_gilmancohen?source=rss-ebf339ee554c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 21:18:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adin_gilmancohen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Final Project Proposal]]></title>
            <link>https://medium.com/@adin_gilmancohen/final-project-proposal-48c4d281d471?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/48c4d281d471</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Sat, 07 Nov 2026 07:10:28 GMT</pubDate>
            <atom:updated>2026-11-07T07:10:28.788Z</atom:updated>
            <content:encoded><![CDATA[<p>By Adin, Ethan, Shein, Eva, Clay</p><p>We have narrowed in on the application of a TUI to reshape the interaction of socializing at a gathering, such as a party or a bar. Our core question is, how might we make it easier for people to find each other- to identify the people that they most want to interact with due to similar interests, backgrounds, or social batteries.</p><p>We have explored the idea of gathering this information from each person through a survey on their phone or input to another device, and then displaying it in a novel way.</p><p>One method could be through ceiling or body mounted projection. A camera would identify each person and project a line onto the ground that they could follow. It could also project a circule around them with different colored arrows pointing to different people. In either case, the color of the line or arrow would corrolate to a shared interest, background, job etc. This idea draws insperation from installations like the viral Van Goh Immersive Experience projection art piece.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*O9fgZbe593i5HoWAVcaPMQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20VQLgAH_hCFQRFCSgfP3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4t8TAONRQa-S9aUYeDFNg.png" /></figure><p>Another method is through a bracelet that every patron wears. When you get close to someone that has a shared interest, the braclet vibrates and displays what you have in common. The bracelet may also have a game to help the people break the ice when they find each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RX5w4uNXzhSr8sVu3m1qOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWs0scS0l68dQrOi55Dm1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwVVDp2jb3JnTXPjLXYIoQ.png" /></figure><p>As a group, we are still narrowing in on how exactly these ideas will combine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48c4d281d471" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thumb Pact]]></title>
            <link>https://medium.com/@adin_gilmancohen/thumb-pact-2020ed36a951?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2020ed36a951</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 19:01:56 GMT</pubDate>
            <atom:updated>2026-10-28T20:33:53.911Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lab 9- Simple Mechanics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YajAtQugAA_QzyAyEm2gCw.jpeg" /></figure><p>Imagine a soviet nuclear submarine with its two keys, both of which must be turned to launch a missile. What areas of your own life could use this idea of mutual consent to acess something? This box uses two thumbprint scanners to open a box only when two pre designated people scan at the same time. It can not be opened by on person alone.</p><p>This opens up the possibility of many interactions. Maybe it helps someone with addiction only use a substance in company, or an elderly person only take medications when supervised, or helps a couple not use their phones when they are together.</p><p>This build uses tension spring loaded door retainined by a selenoid. When the thumb print scanners are both triggered, the selenoid drops and the door slams open. The selenoid is actuated by a TP120 transistor switch. This box does not require a laptop, and runs of 12v DC wall power through a plug in the back. When the box opens, a small bird on a rack and pinion moves up and down.</p><p>This build took four iterations to get all the moving parts working together. The first selenoid was not strong enough to overcome the friction of the door and had to be replaced with a larger one.</p><h4>Video</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fc_-aIu3JwoA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2Fc_-aIu3JwoA%3Fis%3D1sN2QuiZTjrEMB6v&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fc_-aIu3JwoA%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0d91023e7f045becb1162c7ba52fe3b/href">https://medium.com/media/d0d91023e7f045becb1162c7ba52fe3b/href</a></iframe><h4>Materials:</h4><ul><li>2x Adafruit Thumprint scanners</li><li>1x 12V DC 5N selenoid</li><li>1x TP120</li><li>1x Diode</li><li>1x Arduino Uno</li><li>Printed parts</li></ul><h4>Code</h4><pre>// Dual thumbprint lock.<br>// Unlocks (fires the solenoid and moves the servo) when two DIFFERENT<br>// enrolled people scan on the two scanners within 4 seconds of each other.<br>// Anyone can use either scanner - each person must be enrolled on<br>// both scanners under the same ID number.<br><br>#include &lt;Adafruit_Fingerprint.h&gt;<br>#include &lt;Servo.h&gt;<br><br>// ---------- Settings you might want to change ----------<br>const unsigned long MATCH_WINDOW = 4000;      // both scans must be within 4 seconds<br>const unsigned long UNLOCK_TIME = 2000;       // solenoid stays on for 2 seconds<br>const unsigned long PAUSE_AFTER_READ = 1500;  // ignore a scanner for 1.5s after it reads<br>const int SOLENOID_PIN = 7;                   // goes to the TIP120 (through the resistor)<br>const unsigned long MAX_TEST_TIME = 5000;     // longest a typed test command can hold it on<br><br>const int SERVO_PIN = 9;                      // servo&#39;s signal wire (usually orange or yellow)<br>const int SERVO_REST_ANGLE = 60;              // where the servo sits normally (degrees)<br>const int SERVO_UNLOCK_ANGLE = 0;             // where it moves to when unlocking (degrees)<br>const int SERVO_CYCLES = 7;                   // how many times it moves out and back<br>const unsigned long SERVO_CYCLE_TIME = 1000;  // one out-and-back takes 1 second<br>// -------------------------------------------------------<br><br>Servo lockServo;<br><br>// Scanner A: the board&#39;s first built-in serial connection (pins 0/1)<br>Adafruit_Fingerprint scannerA(&amp;Serial1);<br><br>// Scanner B: the second built-in serial connection (pin 11 = talk, pin 12 = listen)<br>UART scannerBLine(11, 12);<br>Adafruit_Fingerprint scannerB(&amp;scannerBLine);<br><br>// What each scanner last matched, and when. ID 0 means &quot;nothing recent&quot;.<br>int lastIdA = 0;<br>int lastIdB = 0;<br>unsigned long lastTimeA = 0;<br>unsigned long lastTimeB = 0;<br><br>unsigned long scannerAPausedUntil = 0;<br>unsigned long scannerBPausedUntil = 0;<br><br>// Whether each scanner was found at startup. A missing scanner is skipped,<br>// so the solenoid can still be tested by typing commands.<br>bool scannerAOk = false;<br>bool scannerBOk = false;<br><br>void setup() {<br>  pinMode(SOLENOID_PIN, OUTPUT);<br>  digitalWrite(SOLENOID_PIN, LOW);   // make sure the lock starts OFF<br><br>  lockServo.write(SERVO_REST_ANGLE); // set the start position first so it doesn&#39;t jump<br>  lockServo.attach(SERVO_PIN);<br><br>  Serial.begin(9600);                // messages to your computer (Serial Monitor)<br>  delay(3000);                       // give the computer 3 seconds to connect<br><br>  Serial.println(&quot;Starting up...&quot;);<br>  scannerAOk = startScanner(scannerA, &quot;Scanner A&quot;);<br>  scannerBOk = startScanner(scannerB, &quot;Scanner B&quot;);<br><br>  if (scannerAOk &amp;&amp; scannerBOk) {<br>    Serial.println(&quot;Ready. Two different people: scan within 4 seconds to unlock.&quot;);<br>  } else {<br>    Serial.println(&quot;TEST MODE: a scanner is missing, so fingerprint unlocking is off.&quot;);<br>  }<br>  Serial.println(&quot;Testing: type u + Enter to do a full unlock (solenoid + servo),&quot;);<br>  Serial.println(&quot;         s + Enter to move just the servo,&quot;);<br>  Serial.println(&quot;         or a number of milliseconds (e.g. 500) + Enter to fire just the solenoid that long.&quot;);<br>}<br><br>// Connects to one scanner, trying both speeds it might use.<br>// Returns true if found, false if not (the program keeps going either way).<br>bool startScanner(Adafruit_Fingerprint &amp;scanner, const char *name) {<br>  scanner.begin(57600);<br>  if (!scanner.verifyPassword()) {<br>    scanner.begin(115200);<br>    if (!scanner.verifyPassword()) {<br>      Serial.print(name);<br>      Serial.println(&quot; NOT found - skipping it.&quot;);<br>      return false;<br>    }<br>  }<br>  scanner.getTemplateCount();<br>  Serial.print(name);<br>  Serial.print(&quot; found. Fingerprints stored: &quot;);<br>  Serial.println(scanner.templateCount);<br>  return true;<br>}<br><br>void loop() {<br>  checkTypedCommand();<br><br>  // Check scanner A (unless it&#39;s missing or paused)<br>  if (scannerAOk &amp;&amp; millis() &gt; scannerAPausedUntil) {<br>    int result = checkFinger(scannerA);<br>    if (result != -1) {<br>      scannerAPausedUntil = millis() + PAUSE_AFTER_READ;<br>      if (result &gt; 0) {<br>        lastIdA = result;<br>        lastTimeA = millis();<br>      }<br>      report(&quot;Scanner A&quot;, result);<br>      checkForUnlock();<br>    }<br>  }<br><br>  // Check scanner B (unless it&#39;s missing or paused)<br>  if (scannerBOk &amp;&amp; millis() &gt; scannerBPausedUntil) {<br>    int result = checkFinger(scannerB);<br>    if (result != -1) {<br>      scannerBPausedUntil = millis() + PAUSE_AFTER_READ;<br>      if (result &gt; 0) {<br>        lastIdB = result;<br>        lastTimeB = millis();<br>      }<br>      report(&quot;Scanner B&quot;, result);<br>      checkForUnlock();<br>    }<br>  }<br>}<br><br>// The unlock rule: both scanners matched, different people, within the time window<br>void checkForUnlock() {<br>  if (lastIdA == 0 || lastIdB == 0) {<br>    Serial.println(&quot;   -&gt; Waiting for the other scanner...&quot;);<br>    return;<br>  }<br><br>  // How far apart the two scans were<br>  unsigned long gap = (lastTimeA &gt; lastTimeB) ? lastTimeA - lastTimeB : lastTimeB - lastTimeA;<br><br>  if (gap &gt; MATCH_WINDOW) {<br>    Serial.print(&quot;   -&gt; Too slow: scans were &quot;);<br>    Serial.print(gap / 1000.0, 1);<br>    Serial.println(&quot; seconds apart. Waiting for the other scanner...&quot;);<br>    return;<br>  }<br><br>  if (lastIdA == lastIdB) {<br>    Serial.println(&quot;   -&gt; Same person on both scanners - need two different people.&quot;);<br>    return;<br>  }<br><br>  Serial.println(&quot;   -&gt; UNLOCK!&quot;);<br>  unlock();<br><br>  // Forget both scans so the next unlock needs two fresh scans<br>  lastIdA = 0;<br>  lastIdB = 0;<br>}<br><br>// The full unlock: solenoid on and servo moves, hold, then both go back<br>// The solenoid only stays on for UNLOCK_TIME (so it doesn&#39;t overheat),<br>// while the servo keeps repeating its motion for all its cycles.<br>void unlock() {<br>  unsigned long start = millis();<br>  digitalWrite(SOLENOID_PIN, HIGH);<br>  bool solenoidOn = true;<br><br>  for (int i = 0; i &lt; SERVO_CYCLES; i++) {<br>    lockServo.write(SERVO_UNLOCK_ANGLE);<br>    delay(SERVO_CYCLE_TIME / 2);<br>    lockServo.write(SERVO_REST_ANGLE);<br>    delay(SERVO_CYCLE_TIME / 2);<br><br>    // Turn the solenoid off once its time is up, even mid-wiggle<br>    if (solenoidOn &amp;&amp; millis() - start &gt;= UNLOCK_TIME) {<br>      digitalWrite(SOLENOID_PIN, LOW);<br>      solenoidOn = false;<br>    }<br>  }<br><br>  digitalWrite(SOLENOID_PIN, LOW);   // just in case UNLOCK_TIME is longer than the wiggle<br>  Serial.println(&quot;   -&gt; Locked again.&quot;);<br>}<br><br>// Moves just the servo out and back, all its cycles (for testing)<br>void moveServo() {<br>  for (int i = 0; i &lt; SERVO_CYCLES; i++) {<br>    lockServo.write(SERVO_UNLOCK_ANGLE);<br>    delay(SERVO_CYCLE_TIME / 2);<br>    lockServo.write(SERVO_REST_ANGLE);<br>    delay(SERVO_CYCLE_TIME / 2);<br>  }<br>  Serial.println(&quot;   -&gt; Servo back at rest.&quot;);<br>}<br><br>// Turns the solenoid on for the given number of milliseconds, then off<br>void fireSolenoid(unsigned long howLong) {<br>  digitalWrite(SOLENOID_PIN, HIGH);<br>  delay(howLong);<br>  digitalWrite(SOLENOID_PIN, LOW);<br>  Serial.println(&quot;   -&gt; Locked again.&quot;);<br>}<br><br>// For mechanical testing: control the lock from the Serial Monitor.<br>//   u      -&gt; full unlock (solenoid + servo) for the normal UNLOCK_TIME<br>//   s      -&gt; move just the servo out and back<br>//   500    -&gt; fire just the solenoid for 500 milliseconds (up to MAX_TEST_TIME)<br>void checkTypedCommand() {<br>  if (!Serial.available()) return;<br><br>  String typed = Serial.readStringUntil(&#39;\n&#39;);<br>  typed.trim();                      // remove spaces and line endings<br>  if (typed.length() == 0) return;<br><br>  if (typed == &quot;u&quot; || typed == &quot;U&quot;) {<br>    Serial.println(&quot;[Test] Full unlock (solenoid + servo)...&quot;);<br>    unlock();<br>    return;<br>  }<br><br>  if (typed == &quot;s&quot; || typed == &quot;S&quot;) {<br>    Serial.println(&quot;[Test] Moving servo...&quot;);<br>    moveServo();<br>    return;<br>  }<br><br>  long howLong = typed.toInt();      // 0 if it isn&#39;t a number<br>  if (howLong &gt; 0) {<br>    if (howLong &gt; (long)MAX_TEST_TIME) {<br>      howLong = MAX_TEST_TIME;<br>      Serial.print(&quot;[Test] Limited to &quot;);<br>      Serial.print(MAX_TEST_TIME);<br>      Serial.println(&quot; ms so the solenoid doesn&#39;t overheat.&quot;);<br>    }<br>    Serial.print(&quot;[Test] Firing solenoid for &quot;);<br>    Serial.print(howLong);<br>    Serial.println(&quot; ms...&quot;);<br>    fireSolenoid(howLong);<br>    return;<br>  }<br><br>  Serial.println(&quot;[Test] Didn&#39;t understand. Type u, s, or a number of milliseconds.&quot;);<br>}<br><br>// Prints one scanner&#39;s result<br>void report(const char *name, int result) {<br>  Serial.print(name);<br>  if (result &gt; 0) {<br>    Serial.print(&quot;: MATCH #&quot;);<br>    Serial.println(result);<br>  } else {<br>    Serial.println(&quot;: no match&quot;);<br>  }<br>}<br><br>// Returns: -1 = no finger, 0 = finger but no match, 1+ = ID of the matched print<br>int checkFinger(Adafruit_Fingerprint &amp;scanner) {<br>  if (scanner.getImage() != FINGERPRINT_OK) return -1;    // take a picture<br>  if (scanner.image2Tz() != FINGERPRINT_OK) return 0;     // turn it into a pattern<br>  if (scanner.fingerSearch() != FINGERPRINT_OK) return 0; // look it up in memory<br>  return scanner.fingerID;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2020ed36a951" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 7- Servo Crawler]]></title>
            <link>https://medium.com/@adin_gilmancohen/lab-7-servo-crawler-4bdb91f07631?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bdb91f07631</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 03:34:46 GMT</pubDate>
            <atom:updated>2026-10-19T03:34:46.372Z</atom:updated>
            <content:encoded><![CDATA[<p>This is it- the culmination of 7 years of mechanical engineering experience. This crawler robot uses a servo motor to limp across a surface not unlike a poisoned rat.</p><h4>Materiels:</h4><ul><li>Arduino</li><li>Servo</li><li>Cardboard</li><li>Tape</li><li>Wires</li></ul><h4>Code</h4><pre>/* Servo Sweep<br><br> just makes the servo sweep back and forth repeatedly<br><br> by BARRAGAN <br> This example code is in the public domain.<br><br> modified 8 Nov 2013<br> by Scott Fitzgerald<br> http://www.arduino.cc/en/Tutorial/Sweep<br>*/<br><br>#include &lt;Servo.h&gt;<br><br>int servoPin = 7; // pin for the servo motor<br><br>Servo myservo;  // create servo object to control a servo<br>// twelve servo objects can be created on most boards<br><br>int pos = 0;    // variable to store the servo position<br><br>void setup() {<br>  myservo.attach(servoPin); // attaches the servo on pin servoPin to the servo object<br>}<br><br>void loop() {<br>  for (pos = 0; pos &lt;= 180; pos += 1) { // goes from 0 degrees to 180 degrees<br>    // in steps of 1 degree<br>    myservo.write(pos);              // tell servo to go to position in variable &#39;pos&#39;<br>    delay(15);                       // waits 15ms for the servo to reach the position<br>  }<br>  for (pos = 180; pos &gt;= 0; pos -= 1) { // goes from 180 degrees to 0 degrees<br>    myservo.write(pos);              // tell servo to go to position in variable &#39;pos&#39;<br>    delay(15);                       // waits 15ms for the servo to reach the position<br>  }<br>}</pre><h4>Video</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQHv2ITEqdFE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FQHv2ITEqdFE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQHv2ITEqdFE%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf6b2408fd5d40f0bd5b73a6d4b3318e/href">https://medium.com/media/cf6b2408fd5d40f0bd5b73a6d4b3318e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bdb91f07631" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phone Bedtime Box]]></title>
            <link>https://medium.com/@adin_gilmancohen/phone-bedtime-box-513e4c11b4b0?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/513e4c11b4b0</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 22:07:21 GMT</pubDate>
            <atom:updated>2026-10-12T22:14:09.981Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lab 6- DC Motors</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rEgQRrHdPk8w81iJFhfBVg.jpeg" /></figure><p>Thinking about the theme of phone use that my midterm group is focusing on, I decided to build a device to help enforce “no phone before bed” rules.</p><p>I started by building the circuit given in the lab instructions and confirmed that I could control the speed of my DC motor with the potentiometer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52-awXdpKbHxDGW8zr1HKw.jpeg" /></figure><p>I then set up a circuit that would tell when a phone was covering the opening in the top of a box with a photo cell. If the phone is lifted, the motor with an off center weight starts slowly and then speeds up. This creates a haptic feedback not unlike a phone ringing that the user can only address by replacing their phone. As a product, this would be set up with a “bed time,” and if the phone was not placed on the box by then it would start buzzing. It could be integrated with phone charging, and designed so the user couldn’t use the phone while it rested on the box.</p><h4>Code</h4><pre>const int photocellPin = A0;   // light sensor<br>const int motorPin = 9;        // goes to the transistor that switches the motor<br><br>int lightThreshold = 500;      // readings above this count as &quot;phone lifted&quot;<br>int startSpeed = 60;           // speed when the motor first turns on (0-255)<br>int maxSpeed = 255;            // top speed (255 is full power)<br>unsigned long rampTime = 10000;  // how long it takes to reach top speed, in milliseconds<br><br>bool uncovered = false;          // remembers whether the phone is currently lifted<br>unsigned long uncoveredSince = 0;  // the moment the phone was lifted<br><br>void setup() {<br>  pinMode(motorPin, OUTPUT);<br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  int lightLevel = analogRead(photocellPin);   // 0 (dark) to 1023 (bright)<br>  Serial.println(lightLevel);<br><br>  if (lightLevel &gt; lightThreshold) {<br>    if (!uncovered) {              // the phone was just lifted: start the clock<br>      uncovered = true;<br>      uncoveredSince = millis();<br>    }<br><br>    unsigned long elapsed = millis() - uncoveredSince;   // how long it&#39;s been lifted<br>    if (elapsed &gt; rampTime) {<br>      elapsed = rampTime;          // stop climbing once we hit top speed<br>    }<br><br>    int motorSpeed = map(elapsed, 0, rampTime, startSpeed, maxSpeed);<br>    analogWrite(motorPin, motorSpeed);<br>  } else {<br>    uncovered = false;             // covered again: motor off, clock resets<br>    analogWrite(motorPin, 0);<br>  }<br><br>  delay(50);<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I7x52c7gmJLufj-73aiszw.jpeg" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FeB4UnJNseEo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FeB4UnJNseEo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FeB4UnJNseEo%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c00b608450c0975732179f10db5ee012/href">https://medium.com/media/c00b608450c0975732179f10db5ee012/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=513e4c11b4b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Candle Music]]></title>
            <link>https://medium.com/@adin_gilmancohen/candle-music-1a27ae6439d6?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a27ae6439d6</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 05:06:52 GMT</pubDate>
            <atom:updated>2026-10-05T05:06:52.778Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lab 5-Output: Piezo Speakers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9WTJW8QpIxew_MfZWCmbA.jpeg" /></figure><h4>Description</h4><p>I was working on this lab with a candle burning on my desk and had to inspiration to see if I could turn the candle light into music the way a wind chime turns wind into music. I used two photocells to pick up the flickering of the candle at different points in space, and output the signals as notes on two piezo speakers. The device averages the resistance of each photo cell over several readings to prevent noise, and each speaker jumps between notes on the same scale an octave apart so they always sound good together. The code reads the baseline brightness and sets it as a starting point so the device works regardless of the background brightness in the room. I wasn’t happy with how it sounded with the speaker we got in class, so I bought two higher quality piezo speakers. The entire contraption was mounted in a block of Styrofoam.</p><p>The circuit used is the same voltage divider that Lab 4 used for it’s photo cell. Two of these circuits run the two photo cells and each feed into a different analog input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v2kKaupl_an8BjBAnu98Zg.png" /><figcaption>This circuit is repeated twice to run two speakers off two photo-cells</figcaption></figure><h4>Components Used</h4><ul><li>Arduino Uno R4 Minima</li><li>2x 10k ohm resistors</li><li>wires</li><li>2x Piezo Speakers</li><li>2x Photo Cells</li></ul><h4>Code</h4><pre>// ============================================================<br>//  CANDLE THEREMIN – Two Voices  (for Arduino Uno R4)<br>//  Left photocell (A0)  → speaker on pin 8 (lower notes)<br>//  Right photocell (A1) → speaker on pin 9 (higher notes)<br>//  Both use the same pentatonic scale, so they always harmonize.<br>// ============================================================<br><br>#include &quot;FspTimer.h&quot;   // the Uno R4&#39;s built-in timer tools<br><br>// ---------- Pins ----------<br>const int SENSOR_LEFT   = A0;<br>const int SENSOR_RIGHT  = A1;<br>const int SPEAKER_LEFT  = 8;<br>const int SPEAKER_RIGHT = 9;<br><br>// ---------- Notes (C major pentatonic) ----------<br>// Same scale for both, but the right speaker plays an octave higher.<br>const int LOW_NOTES[]  = {262, 294, 330, 392, 440, 523, 587, 659, 784, 880};<br>const int HIGH_NOTES[] = {523, 587, 659, 784, 880, 1047, 1175, 1319, 1568, 1760};<br>const int NUM_NOTES = 10;<br><br>// ---------- Knobs (play with these!) ----------<br>const float SMOOTH      = 0.05;    // 0–1. Lower = calmer, higher = jumpier<br>const float RANGE_RELAX = 0.0005;  // how fast the range &quot;zooms in&quot; when light settles (~10 s)<br>const float MIN_SPAN    = 10;      // smallest brightness range spread across the scale.<br>                                   //   Lower = more sensitive (but may follow noise)<br>const float HYSTERESIS  = 0.3;     // &quot;sticky zone&quot; between notes (0 = none, 0.5 = very sticky)<br>const unsigned long MIN_HOLD_MS = 120;  // shortest time a note plays before it can change<br>const unsigned long SAMPLE_MS   = 5;    // read sensors every 5 ms<br><br>// ---------- Speakers: one timer each ----------<br>// A timer is like a tiny metronome inside the chip. Each tick, it<br>// flips its speaker pin on or off. Two flips = one sound wave, so<br>// the timer ticks at twice the note&#39;s frequency.<br>FspTimer timerLeft, timerRight;<br>volatile bool leftState = false, rightState = false;<br><br>// ---------- One &quot;voice&quot; = one sensor + one speaker ----------<br>// (This must come before any functions, or the Arduino app gets confused.)<br>struct Voice {<br>  int sensorPin;<br>  const int *notes;     // which note list this voice plays<br>  FspTimer *timer;      // which speaker timer it controls<br>  float smoothed;       // smoothed brightness<br>  float lo, hi;         // darkest and brightest seen recently<br>  int note;             // which note (0–9) is playing<br>  unsigned long lastChange;<br>};<br><br>Voice leftVoice  = {SENSOR_LEFT,  LOW_NOTES,  &amp;timerLeft};<br>Voice rightVoice = {SENSOR_RIGHT, HIGH_NOTES, &amp;timerRight};<br><br>void leftTick(timer_callback_args_t *args) {<br>  leftState = !leftState;<br>  digitalWrite(SPEAKER_LEFT, leftState);<br>}<br><br>void rightTick(timer_callback_args_t *args) {<br>  rightState = !rightState;<br>  digitalWrite(SPEAKER_RIGHT, rightState);<br>}<br><br>// Grab a free timer and start it making a tone.<br>bool startSpeaker(FspTimer &amp;t, GPTimerCbk_f tick, int pin, int freq) {<br>  pinMode(pin, OUTPUT);<br>  uint8_t type;<br>  int8_t channel = FspTimer::get_available_timer(type);<br>  if (channel &lt; 0) channel = FspTimer::get_available_timer(type, true);<br>  if (channel &lt; 0) return false;   // no timers left<br><br>  t.begin(TIMER_MODE_PERIODIC, type, channel, freq * 2.0f, 50.0f, tick);<br>  t.setup_overflow_irq();<br>  t.open();<br>  t.start();<br>  return true;<br>}<br><br>void playNote(FspTimer &amp;t, int freq) {<br>  t.set_frequency(freq * 2.0f);<br>}<br><br>unsigned long lastSample = 0;<br>int printCounter = 0;<br><br>// Average many quick readings to cancel electrical fuzz.<br>// The first reading after switching pins is often off, so throw it away.<br>float readAveraged(int pin) {<br>  analogRead(pin);<br>  long sum = 0;<br>  for (int i = 0; i &lt; 16; i++) sum += analogRead(pin);<br>  return sum / 16.0;<br>}<br><br>// Start a voice at its current brightness.<br>// The &quot;&amp;&quot; means &quot;work on the real voice, not a copy of it&quot;.<br>void startVoice(Voice &amp;v) {<br>  v.smoothed = readAveraged(v.sensorPin);<br>  v.lo = v.smoothed - MIN_SPAN / 2;<br>  v.hi = v.smoothed + MIN_SPAN / 2;<br>  v.note = NUM_NOTES / 2;<br>  v.lastChange = 0;<br>}<br><br>// Update a voice: read, smooth, pick a note, and play it if it changed.<br>void updateVoice(Voice &amp;v, unsigned long now) {<br>  float raw = readAveraged(v.sensorPin);<br>  v.smoothed += SMOOTH * (raw - v.smoothed);<br><br>  // Auto-stretch: expand instantly, shrink slowly<br>  if (v.smoothed &lt; v.lo) v.lo = v.smoothed; else v.lo += RANGE_RELAX * (v.smoothed - v.lo);<br>  if (v.smoothed &gt; v.hi) v.hi = v.smoothed; else v.hi += RANGE_RELAX * (v.smoothed - v.hi);<br>  if (v.hi - v.lo &lt; MIN_SPAN) {<br>    float mid = (v.hi + v.lo) / 2;<br>    v.lo = mid - MIN_SPAN / 2;<br>    v.hi = mid + MIN_SPAN / 2;<br>  }<br><br>  // Where does the brightness sit on the scale? (0 = darkest, 9 = brightest)<br>  float position = (v.smoothed - v.lo) / (v.hi - v.lo) * (NUM_NOTES - 1);<br><br>  // Change note only if clearly past the sticky zone<br>  if (fabs(position - v.note) &gt; 0.5 + HYSTERESIS &amp;&amp; now - v.lastChange &gt; MIN_HOLD_MS) {<br>    int newNote = constrain((int)(position + 0.5), 0, NUM_NOTES - 1);<br>    if (newNote != v.note) {<br>      v.note = newNote;<br>      v.lastChange = now;<br>      playNote(*v.timer, v.notes[v.note]);<br>    }<br>  }<br>}<br><br>void setup() {<br>  Serial.begin(115200);<br>  startVoice(leftVoice);<br>  startVoice(rightVoice);<br><br>  // Start both speakers playing – they never stop<br>  bool okL = startSpeaker(timerLeft,  leftTick,  SPEAKER_LEFT,  LOW_NOTES[leftVoice.note]);<br>  bool okR = startSpeaker(timerRight, rightTick, SPEAKER_RIGHT, HIGH_NOTES[rightVoice.note]);<br>  if (!okL || !okR) Serial.println(&quot;Couldn&#39;t get a free timer for a speaker!&quot;);<br>}<br><br>void loop() {<br>  unsigned long now = millis();<br>  if (now - lastSample &lt; SAMPLE_MS) return;<br>  lastSample = now;<br><br>  updateVoice(leftVoice, now);<br>  updateVoice(rightVoice, now);<br><br>  // ---- Serial Plotter (every 4th sample) ----<br>  if (++printCounter &gt;= 4) {<br>    printCounter = 0;<br>    Serial.print(&quot;leftLight:&quot;);   Serial.print(leftVoice.smoothed);<br>    Serial.print(&quot;,rightLight:&quot;); Serial.print(rightVoice.smoothed);<br>    Serial.print(&quot;,leftNote:&quot;);   Serial.print(leftVoice.note);<br>    Serial.print(&quot;,rightNote:&quot;);  Serial.println(rightVoice.note);<br>  }<br>}</pre><h4>Video</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-m07mmw_7c0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F-m07mmw_7c0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-m07mmw_7c0%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/331fafdeac926649dec4494fcc8882b9/href">https://medium.com/media/331fafdeac926649dec4494fcc8882b9/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a27ae6439d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flappy Bird Emulator and Deoderant Reminder]]></title>
            <link>https://medium.com/@adin_gilmancohen/flappy-bird-emulator-and-deoderant-reminder-7cf306809940?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cf306809940</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 21:30:32 GMT</pubDate>
            <atom:updated>2026-09-26T21:30:32.053Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lab 4: Photocells, FSRs</h3><p>This lab introduced force sensors and photo cells as new inputs, and introduced p5.js as a new visual output. I did this lab in 5 parts. Part 1–3 test each new componant introduced. Part 4 demonstrates p5.js with a Flappy Bird Emulator. Part 5 demonstrates integrating a photo sensor into an object with a deoderant reminder lamp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nJIdxncuY67CBvgrHoHbnw.jpeg" /></figure><h3>Part 1: P5.js</h3><p>I used my Claude Code agent to install p5.js and ran the code provided in the lab to link the size of a circle on the screen to an analog input on my arduino.</p><pre>let latestData = &quot;&quot;;<br>let status = &quot;disconnected&quot;;<br><br>function setup() {<br>  createCanvas(windowWidth, windowHeight);<br>  textSize(24);<br><br>  let connectButton = createButton(&quot;Connect to Arduino&quot;);<br>  connectButton.position(10, 10);<br>  connectButton.mousePressed(initSerial);<br>}<br><br>async function initSerial() {<br>  try {<br>    const port = await navigator.serial.requestPort();<br>    await port.open({ baudRate: 9600 });<br>    status = &quot;connected&quot;;<br><br>    const decoder = new TextDecoderStream();<br>    port.readable.pipeTo(decoder.writable);<br>    const reader = decoder.readable.getReader();<br><br>    // Use setTimeout to read outside p5&#39;s loop detection<br>    function scheduleRead() {<br>      reader.read().then(({ value, done }) =&gt; {<br>        if (done) return;<br>        if (value) latestData = value.trim();<br>        scheduleRead(); // schedule next read<br>      });<br>    }<br>    scheduleRead();<br><br>  } catch (err) {<br>    status = &quot;error: &quot; + err.message;<br>  }<br>}<br><br>function draw() {<br>  background(255);<br>  fill(0);<br>  noStroke();<br><br>  text(&quot;Status: &quot; + status, 10, 60);<br>  text(&quot;Value: &quot; + latestData, 10, 90);<br><br>  if (latestData !== &quot;&quot; &amp;&amp; !isNaN(latestData)) {<br>    let val = Number(latestData);<br>    let diameter = map(val, 0, 1023, 10, 400);<br>    ellipse(width / 2, height / 2, diameter, diameter);<br>  }<br>}</pre><h3>Part 2:Photo Cells</h3><p>I built the following voltage divider circuit to read the changing resistance of my photo cell with the analog input on my Arduino.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g3skrEPZR1a22HSMlip-KA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*se8N6Fifj5ceSn3Ox2CBeg.png" /></figure><p>I ran the following code on the Arduino side.</p><pre>const int analogInPin = A0;<br><br>void setup() {<br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  // read the sensor value from the analog input pin<br>  const int sensorValue = analogRead(analogInPin);<br><br>  Serial.println(sensorValue);<br><br>  // wait 2 milliseconds before the next loop<br>  // for the analog-to-digital converter to settle<br>  // after the last reading:<br>  delay(100);<br>}</pre><p>I tested this circuit by shining a flashlight at the photo sensor and covering it with my finger. The size of the circle on screen responded to the light and dark. I increased the delay from 2 to 100 to make it smoother and less jumpy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4G_HT8KVkLHNMzvNsExaQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cSnbKGUf9T0t4O2JE5o2mw.jpeg" /></figure><h3>Part 3: Force Sensor</h3><p>I replaced the photo sensor with the force sensor in the same spot in the circuit as they both use the same voltage divider circuit with the same resistor. I ran the same test again and confirmed I could control the size of the circle on the screen by pressing on the force sensor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0VZ8qzu36Nt8nx-4GX-qyA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T6vdvenmVNoguOaHpkNjRg.jpeg" /></figure><h3>Part 4: Flappy Bird Emulator (p5.js demo)</h3><p>I used Claude Code to write a p5.js code block that would make a “Flappy Bird” style game that the user could control by tapping on the force sensor. This worked on the first try.</p><p><strong>Components Used</strong></p><ul><li>FSR (force sensor)</li><li>Photocell</li><li>10k ohm resistor</li><li>Arduino Uno R4 Minima</li><li>Wires</li><li>Laptop running Chrome + p5.js web editor</li></ul><h4>Code</h4><pre>let port, reader;<br>let latestData = &quot;0&quot;;<br><br>let birdY = 300;<br>let birdVelocity = 0;<br>const gravity = 0.6;<br>const flapStrength = -10;<br><br>let pipes = [];<br>const pipeWidth = 60;<br>const pipeGap = 150;<br>const pipeSpeed = 3;<br>let frameCounter = 0;<br><br>let score = 0;<br>let gameState = &quot;waiting&quot;; // &quot;waiting&quot; | &quot;playing&quot; | &quot;gameover&quot;<br><br>const TAP_THRESHOLD = 300; // tune this once you see real sensor numbers<br>let wasAboveThreshold = false;<br><br>async function initSerial() {<br>  port = await navigator.serial.requestPort();<br>  await port.open({ baudRate: 9600 });<br>  reader = port.readable.getReader();<br>  readSerial();<br>}<br><br>function readSerial() {<br>  reader.read().then(({ value, done }) =&gt; {<br>    if (done) return;<br>    if (value) {<br>      let text = new TextDecoder().decode(value);<br>      latestData = text.trim();<br>      checkForTap();<br>    }<br>    readSerial(); // schedule the next read instead of looping<br>  });<br>}<br><br>function checkForTap() {<br>  let val = parseInt(latestData);<br>  if (isNaN(val)) return;<br><br>  let isAboveThreshold = val &gt; TAP_THRESHOLD;<br>  if (isAboveThreshold &amp;&amp; !wasAboveThreshold) {<br>    onTap();<br>  }<br>  wasAboveThreshold = isAboveThreshold;<br>}<br><br>function onTap() {<br>  if (gameState === &quot;waiting&quot;) {<br>    gameState = &quot;playing&quot;;<br>  }<br>  if (gameState === &quot;playing&quot;) {<br>    birdVelocity = flapStrength;<br>  } else if (gameState === &quot;gameover&quot;) {<br>    resetGame();<br>  }<br>}<br><br>function resetGame() {<br>  birdY = 300;<br>  birdVelocity = 0;<br>  pipes = [];<br>  score = 0;<br>  frameCounter = 0;<br>  gameState = &quot;waiting&quot;;<br>}<br><br>function setup() {<br>  createCanvas(400, 600);<br>  let btn = createButton(&quot;Connect to Arduino&quot;);<br>  btn.mousePressed(initSerial);<br>}<br><br>function mousePressed() {<br>  // lets you play with mouse clicks too, in case the FSR isn&#39;t wired yet<br>  onTap();<br>}<br><br>function draw() {<br>  background(135, 206, 235); // sky blue<br><br>  if (gameState === &quot;playing&quot;) {<br>    birdVelocity += gravity;<br>    birdY += birdVelocity;<br><br>    frameCounter++;<br>    if (frameCounter % 90 === 0) {<br>      let gapY = random(100, height - 100 - pipeGap);<br>      pipes.push({ x: width, gapY: gapY, passed: false });<br>    }<br><br>    for (let i = pipes.length - 1; i &gt;= 0; i--) {<br>      let p = pipes[i];<br>      p.x -= pipeSpeed;<br><br>      if (!p.passed &amp;&amp; p.x + pipeWidth &lt; 80) {<br>        p.passed = true;<br>        score++;<br>      }<br><br>      if (p.x + pipeWidth &lt; 0) {<br>        pipes.splice(i, 1);<br>      }<br>    }<br><br>    for (let p of pipes) {<br>      let birdLeft = 80 - 15;<br>      let birdRight = 80 + 15;<br>      let birdTop = birdY - 15;<br>      let birdBottom = birdY + 15;<br><br>      let hitsPipeX = birdRight &gt; p.x &amp;&amp; birdLeft &lt; p.x + pipeWidth;<br>      let hitsGapVertically = birdTop &gt; p.gapY &amp;&amp; birdBottom &lt; p.gapY + pipeGap;<br><br>      if (hitsPipeX &amp;&amp; !hitsGapVertically) {<br>        gameState = &quot;gameover&quot;;<br>      }<br>    }<br><br>    if (birdY &gt; height || birdY &lt; 0) {<br>      gameState = &quot;gameover&quot;;<br>    }<br>  }<br><br>  // draw pipes<br>  fill(34, 139, 34);<br>  for (let p of pipes) {<br>    rect(p.x, 0, pipeWidth, p.gapY);<br>    rect(p.x, p.gapY + pipeGap, pipeWidth, height - (p.gapY + pipeGap));<br>  }<br><br>  // draw bird<br>  fill(255, 220, 0);<br>  ellipse(80, birdY, 30, 30);<br><br>  // UI text<br>  fill(0);<br>  textSize(24);<br>  textAlign(LEFT);<br>  text(&quot;Score: &quot; + score, 10, 30);<br><br>  textAlign(RIGHT);<br>  text(&quot;Sensor: &quot; + latestData, width - 10, 30);<br><br>  textAlign(CENTER);<br>  if (gameState === &quot;waiting&quot;) {<br>    text(&quot;Press the sensor (or click) to start!&quot;, width / 2, height / 2);<br>  } else if (gameState === &quot;gameover&quot;) {<br>    text(&quot;Game Over! Press to restart&quot;, width / 2, height / 2);<br>  }<br>}<br></pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-TuP9EaC470%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2F-TuP9EaC470&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-TuP9EaC470%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/62d25eee3aedcf493eb0a0a8ac23b28d/href">https://medium.com/media/62d25eee3aedcf493eb0a0a8ac23b28d/href</a></iframe><h3>Part 5: Deoderant Reminder</h3><p>Finally, I integrated a photo sensor into the lid of my deoderant so that it would be exposed to dark when closed and bright when open. I was thinking of linking this to a p5.js output, but I wanted it to work without my laptop running so I went with LEDs as the output. I wrote a simple arduino script to set the LED to green and then slowly shift it to red over the course of a day. If I open the deoderant, the system resets to green.</p><p><strong>Components Used</strong></p><ul><li>Photo Cell</li><li>10k ohm resistor</li><li>Arduino Uno R4 Minima</li><li>Wires</li><li>RGB LEDs</li><li>200 ohm resistors</li></ul><h4>Code</h4><pre>const int photoPin = A0;<br>const int redPin = 9;<br>const int greenPin = 10;<br>const int bluePin = 11;<br><br>const int LIGHT_THRESHOLD = 800; // between closed (~660) and open (~900)<br>const unsigned long CYCLE_DURATION = 10000; // 10 seconds<br><br>bool wasOpen = false;<br>unsigned long closeTime = 0;<br><br>void setup() {<br>  pinMode(redPin, OUTPUT);<br>  pinMode(greenPin, OUTPUT);<br>  pinMode(bluePin, OUTPUT);<br>  pinMode(photoPin, INPUT);<br>  Serial.begin(9600);<br>  showRed();<br>  closeTime = millis() - CYCLE_DURATION; // starts already &quot;faded out&quot; to red<br>}<br><br>void loop() {<br>  int lightLevel = analogRead(photoPin);<br>  Serial.println(lightLevel);<br><br>  bool isOpen = lightLevel &gt; LIGHT_THRESHOLD;<br><br>  if (isOpen) {<br>    showGreen();<br>  } else {<br>    if (wasOpen) {<br>      // it just closed this instant, start the fade timer now<br>      closeTime = millis();<br>    }<br>    unsigned long elapsed = millis() - closeTime;<br>    if (elapsed &gt;= CYCLE_DURATION) {<br>      showRed();<br>    } else if (elapsed &lt; CYCLE_DURATION / 2) {<br>      int r = map(elapsed, 0, CYCLE_DURATION / 2, 0, 255);<br>      setColor(r, 255, 0);<br>    } else {<br>      int g = map(elapsed, CYCLE_DURATION / 2, CYCLE_DURATION, 255, 0);<br>      setColor(255, g, 0);<br>    }<br>  }<br><br>  wasOpen = isOpen;<br>  delay(50);<br>}<br><br>void showRed() {<br>  setColor(255, 0, 0);<br>}<br><br>void showGreen() {<br>  setColor(0, 255, 0);<br>}<br><br>void setColor(int r, int g, int b) {<br>  analogWrite(redPin, r);<br>  analogWrite(greenPin, g);<br>  analogWrite(bluePin, b);<br>}</pre><h4>Video</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvAOgyRuLWDg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FvAOgyRuLWDg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvAOgyRuLWDg%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ffd5f6f7fb7e1cb4e7e1ff938e73ce80/href">https://medium.com/media/ffd5f6f7fb7e1cb4e7e1ff938e73ce80/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cf306809940" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Person Energy Mapping Lamp-]]></title>
            <link>https://medium.com/@adin_gilmancohen/two-person-energy-mapping-lamp-6cfdc7eceeb6?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cfdc7eceeb6</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 00:42:48 GMT</pubDate>
            <atom:updated>2026-09-20T00:50:35.528Z</atom:updated>
            <content:encoded><![CDATA[<h3>Lab # 3-<a href="https://bcourses.berkeley.edu/courses/1557982/assignments/9128983">Sensing: Potentiometer</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ven4xipN7H8S2pg7w60K9g.jpeg" /></figure><h3>Description</h3><p>This project explores analog input and potentiometers by mapping the energy of two users to a lamp. Imagine two people in a relationship navigating the issue of mismatched energy. Each user inputs how they are feeling by turning the potentiometer to point at Low (L) Medium (M) or High (H) energy. These inputs are mapped to an RGB LED cluster. Color maps average energy from blue at low to red at high. Flashing represents difference in energy from still when synced to fast flashing when different. This creates an ambient media artifact that visually conveys the respective energy levles in the room and their relationship. With two people, there are 6 output possibilities summarized in the table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*E-CnNuTFS_xI6oCDuue-rQ.png" /></figure><p>I started by soldering my two potentiometers to wires and testing their output with my serial moniter. I then tried mapping one to the brightness and the other to the color of an LED. Once this worked, I started on my lamp.</p><p>To make this, I wired two potentiometers into the A0 and A1 ports with common 5v and ground pins. I wired 3 LEDs with resistors into pins 9,10, and 11 with a common ground pin. I generated the code with Claude, and adjusted it to the colors and flashing speeds I wanted. I made the plate that the components mount to and the lamp shade in Solidworks and 3D printed them. During the process, I accidently wired the center pin of the potentiometer to power and it briefly started smoking.</p><h3>Components Used</h3><ul><li>3x LEDs (RGB)</li><li>Arduino Uno R4 Minima</li><li>3x 220 ohm resistors</li><li>wires</li><li>PETG filament</li><li>2x Potentiometers</li></ul><h3>Code</h3><pre>// Energy Match — two potentiometers drive a shared RGB LED<br>// Pot 1 (Person A): A0      Pot 2 (Person B): A1<br>// RGB LED:  Red -&gt; pin 9   Green -&gt; pin 10   Blue -&gt; pin 11<br>// Assumes a COMMON CATHODE RGB LED (higher PWM = brighter).<br>// If you have a COMMON ANODE LED, invert every analogWrite value: 255 - value.<br><br>const int potA = A0;<br>const int potB = A1;<br>const int redPin   = 9;<br>const int greenPin = 10;<br>const int bluePin  = 11;<br><br>// Energy buckets<br>enum EnergyLevel { TIRED = 0, NEUTRAL = 1, ENERGETIC = 2 };<br><br>// Color for each possible Sum (0-4), per the mapping table<br>struct RGB { int r, g, b; };<br>RGB colorForSum[5] = {<br>  {0,   0,   255}, // Sum 0: Tired+Tired            -&gt; Blue<br>  {0,   180, 180}, // Sum 1: Tired+Neutral           -&gt; Teal<br>  {255, 255, 0},   // Sum 2: Neutral+Neutral / Tired+Energetic -&gt; Yellow<br>  {255, 140, 0},   // Sum 3: Neutral+Energetic       -&gt; Orange<br>  {255, 0,   0}    // Sum 4: Energetic+Energetic     -&gt; Red<br>};<br><br>// Timing for animated patterns<br>unsigned long lastUpdate = 0;<br>float pulsePhase = 0.0;      // for slow breathing pulse<br>bool blinkState = false;<br>unsigned long lastBlinkToggle = 0;<br>const unsigned long BLINK_INTERVAL = 120;   // ms, fast mismatch blink<br>const float PULSE_SPEED = 0.0025;           // radians per ms, slow breathing<br><br>EnergyLevel readEnergy(int pin) {<br>  int val = analogRead(pin);              // 0-1023<br>  if (val &lt; 341) return TIRED;<br>  if (val &lt; 683) return NEUTRAL;<br>  return ENERGETIC;<br>}<br><br>void setColor(int r, int g, int b) {<br>  analogWrite(redPin, r);<br>  analogWrite(greenPin, g);<br>  analogWrite(bluePin, b);<br>}<br><br>void setup() {<br>  pinMode(redPin, OUTPUT);<br>  pinMode(greenPin, OUTPUT);<br>  pinMode(bluePin, OUTPUT);<br>  Serial.begin(9600);   // optional debug output<br>}<br><br>void loop() {<br>  EnergyLevel a = readEnergy(potA);<br>  EnergyLevel b = readEnergy(potB);<br><br>  int sum  = (int)a + (int)b;               // 0-4, picks the color<br>  int diff = abs((int)a - (int)b);          // 0, 1, or 2, picks the pattern<br><br>  RGB c = colorForSum[sum];<br><br>  unsigned long now = millis();<br><br>  if (diff == 0) {<br>    // Perfect match -&gt; solid color<br>    setColor(c.r, c.g, c.b);<br>  }<br>  else if (diff == 1) {<br>    // Close -&gt; slow breathing pulse<br>    pulsePhase += PULSE_SPEED * (now - lastUpdate);<br>    float brightness = (sin(pulsePhase) + 1.0) / 2.0;   // 0.0 - 1.0<br>    setColor(c.r * brightness, c.g * brightness, c.b * brightness);<br>  }<br>  else {<br>    // Opposite -&gt; fast attention-grabbing blink<br>    if (now - lastBlinkToggle &gt;= BLINK_INTERVAL) {<br>      lastBlinkToggle = now;<br>      blinkState = !blinkState;<br>    }<br>    if (blinkState) {<br>      setColor(c.r, c.g, c.b);<br>    } else {<br>      setColor(0, 0, 0);<br>    }<br>  }<br><br>  lastUpdate = now;<br><br>  // Optional debug readout<br>  Serial.print(&quot;A: &quot;); Serial.print(a);<br>  Serial.print(&quot;  B: &quot;); Serial.print(b);<br>  Serial.print(&quot;  Sum: &quot;); Serial.print(sum);<br>  Serial.print(&quot;  Diff: &quot;); Serial.println(diff);<br><br>  delay(10); // small loop delay for smooth analog reads<br>}</pre><h3>Video</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fhw78gVBXD1U%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2Fhw78gVBXD1U%3Fis%3DtwKJWw7ShC92zhHO&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fhw78gVBXD1U%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/58db2d065b8b6e14a913ec423c899944/href">https://medium.com/media/58db2d065b8b6e14a913ec423c899944/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cfdc7eceeb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAM ORB-Lab #2- Digital I/O + Analog Input]]></title>
            <link>https://medium.com/@adin_gilmancohen/ram-orb-lab-2-digital-i-o-analog-input-de8bd796bfab?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/de8bd796bfab</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 05:14:17 GMT</pubDate>
            <atom:updated>2026-09-14T05:14:46.526Z</atom:updated>
            <content:encoded><![CDATA[<h3>Description</h3><p>Inspired by examples of ambient media we saw in class, I wanted to make something that would be usefull for information I see in my day to day life. I often check my task manager to see RAM consumption when my computer starts to lag. I decided to make my version of the ORB we saw in class that would change color based off my RAM utilization. Because I am not concerned with the exact percentage, a color scale is a great way to keep my rough utlization in my periphery.</p><p>To make this, I ran a python script written with Claude to make a variable with my PCs RAM usage. I then called that variable in Arduino IDE and mapped it to a color scale with green being 0 and 70 being red. In between, the RGB LEDs dim to move through green, orange, yellow. Above 90% it starts flashing.</p><p>For the physical hardware, I made a simple box in solid works. I soldered the circuit so I would not need to fit the bread board inside. A ping pong ball acts as the diffuser for the RGB LEDs.</p><p>I spent time testing the color to usage mapping and tweaked it to turn red around when my computer performance dropped noticably - 70%.</p><h3>Components Used</h3><ul><li>3x LEDs (RGB)</li><li>Arduino Uno R4 Minima</li><li>3x 220 ohm resistors</li><li>wires</li><li>PETG filiment</li><li>PingPong Ball</li></ul><h3>Code</h3><p>This project uses two blocks of code, Python and Arduino. The Python shown below sends the RAM usage as a variable to the arduino.</p><pre>&quot;&quot;&quot;<br>RAM Monitor -&gt; Arduino LED<br>--------------------------<br>Polls system RAM usage and sends it over USB serial to an Arduino running<br>ram_led.ino, which maps the percentage to LED color/flashing.<br><br>Setup:<br>    pip install psutil pyserial<br><br>Find your Arduino&#39;s serial port:<br>    - Windows: Device Manager &gt; Ports (COM &amp; LPT), or Arduino IDE &gt; Tools &gt; Port<br>      (usually something like COM3, COM5, etc.)<br>    - Mac/Linux: usually /dev/ttyACM0 or /dev/cu.usbmodemXXXX<br><br>Then set SERIAL_PORT below and run: python ram_monitor.py<br>&quot;&quot;&quot;<br><br>import time<br>import psutil<br>import serial<br><br>SERIAL_PORT = &quot;COM3&quot;   # &lt;-- change this to match your Arduino&#39;s port<br>BAUD_RATE = 9600<br>POLL_INTERVAL = 1.0    # seconds between updates<br><br><br>def main():<br>    ser = serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=1)<br>    time.sleep(2)  # give the Arduino a moment to reset after the port opens<br><br>    print(f&quot;Connected to {SERIAL_PORT}. Sending RAM usage every {POLL_INTERVAL}s. Ctrl+C to stop.&quot;)<br><br>    try:<br>        while True:<br>            ram_percent = int(psutil.virtual_memory().percent)<br>            ser.write(f&quot;{ram_percent}\n&quot;.encode())<br>            print(f&quot;RAM: {ram_percent}%&quot;)<br>            time.sleep(POLL_INTERVAL)<br>    except KeyboardInterrupt:<br>        print(&quot;\nStopping.&quot;)<br>    finally:<br>        ser.close()<br><br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p>The Arduino code is as follows.</p><pre>/*<br> * RAM Usage LED<br> * -------------<br> * Reads a RAM usage percentage (0-100) sent over USB serial by a companion<br> * script running on the host PC, and maps it to LED color by sweeping hue<br> * across a full HSV range: blue (low usage) -&gt; cyan -&gt; green -&gt; yellow -&gt;<br> * red (high usage). Sweeping hue this way puts all 3 channels (not just 2<br> * at a time) to work mixing color via PWM, rather than only ever blending<br> * two colors together.<br> * Above `warnThreshold`, the LED flashes as a warning.<br> * If no data arrives for a while, the LED dims to signal a stale/broken link.<br> *<br> * Pair with ram_monitor.py running on the PC.<br> */<br><br>const int redPin   = 9;<br>const int greenPin = 10;<br>const int bluePin  = 11;<br><br>// Set to true for common-anode RGB LEDs (0 = full on, 255 = off).<br>// Set to false for common-cathode (0 = off, 255 = full on).<br>// If colors look inverted or muddled together, flip this.<br>const bool commonAnode = false;<br><br>// Warn (flash) once RAM usage crosses this percentage.<br>const int warnThreshold = 90;<br><br>// If no serial data arrives for this long, assume the link is down and dim out.<br>const unsigned long dataTimeout = 5000; // ms<br><br>// ---------------------------------------------------------------------------<br>// STATE<br>// ---------------------------------------------------------------------------<br>int   targetR = 0, targetG = 0, targetB = 255; // start at &quot;blue&quot; / 0%<br>float currR = 0, currG = 0, currB = 255;<br><br>bool flashActive = false;<br>bool flashOn = true;<br>unsigned long lastFlashToggle = 0;<br>unsigned long lastData = 0;<br>bool everReceived = false;<br><br>void setup() {<br>  pinMode(redPin, OUTPUT);<br>  pinMode(greenPin, OUTPUT);<br>  pinMode(bluePin, OUTPUT);<br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  if (Serial.available()) {<br>    int pct = Serial.parseInt();<br>    while (Serial.available()) Serial.read(); // flush any trailing newline/junk<br><br>    if (pct &gt;= 0 &amp;&amp; pct &lt;= 100) {<br>      percentToColor(pct);<br>      flashActive = (pct &gt;= warnThreshold);<br>      lastData = millis();<br>      everReceived = true;<br>    }<br>  }<br><br>  bool stale = everReceived &amp;&amp; (millis() - lastData &gt; dataTimeout);<br><br>  updateFlash();<br>  applyColor(stale);<br>  delay(10);<br>}<br><br>// ---------------------------------------------------------------------------<br>// RAM% -&gt; color: sweeps hue from blue (0%) through cyan, green, yellow, to<br>// red (100%). This is what puts all 3 LEDs to work via PWM -- at any given<br>// moment, the exact mix of red/green/blue brightness is what produces each<br>// in-between color (e.g. cyan = green + blue both partially on).<br>// ---------------------------------------------------------------------------<br>void percentToColor(int pct) {<br>  float hue = map(pct, 0, 100, 240, 0); // 240=blue ... 0=red<br>  hsvToRgb(hue, 1.0, 1.0, targetR, targetG, targetB);<br>}<br><br>// Converts HSV (hue 0-360, saturation 0-1, value/brightness 0-1) to RGB (0-255 each).<br>void hsvToRgb(float h, float s, float v, int &amp;r, int &amp;g, int &amp;b) {<br>  float c = v * s;<br>  float x = c * (1 - abs(fmod(h / 60.0, 2) - 1));<br>  float m = v - c;<br><br>  float rf, gf, bf;<br>  if (h &lt; 60)       { rf = c; gf = x; bf = 0; }<br>  else if (h &lt; 120) { rf = x; gf = c; bf = 0; }<br>  else if (h &lt; 180) { rf = 0; gf = c; bf = x; }<br>  else if (h &lt; 240) { rf = 0; gf = x; bf = c; }<br>  else if (h &lt; 300) { rf = x; gf = 0; bf = c; }<br>  else              { rf = c; gf = 0; bf = x; }<br><br>  r = (int)((rf + m) * 255);<br>  g = (int)((gf + m) * 255);<br>  b = (int)((bf + m) * 255);<br>}<br><br>// ---------------------------------------------------------------------------<br>// Flash when RAM is critically high.<br>// ---------------------------------------------------------------------------<br>void updateFlash() {<br>  if (!flashActive) {<br>    flashOn = true;<br>    return;<br>  }<br>  const unsigned long period = 250; // fast warning blink<br>  if (millis() - lastFlashToggle &gt;= period / 2) {<br>    flashOn = !flashOn;<br>    lastFlashToggle = millis();<br>  }<br>}<br><br>// ---------------------------------------------------------------------------<br>// Ease toward target color, gate through flash, dim if the link is stale.<br>// ---------------------------------------------------------------------------<br>void applyColor(bool stale) {<br>  currR += (targetR - currR) * 0.1;<br>  currG += (targetG - currG) * 0.1;<br>  currB += (targetB - currB) * 0.1;<br><br>  float dimFactor = stale ? 0.05 : 1.0; // barely-on &quot;heartbeat&quot; if data has stopped<br><br>  int outR = flashOn ? (int)(currR * dimFactor) : 0;<br>  int outG = flashOn ? (int)(currG * dimFactor) : 0;<br>  int outB = flashOn ? (int)(currB * dimFactor) : 0;<br><br>  writeLED(redPin,   outR);<br>  writeLED(greenPin, outG);<br>  writeLED(bluePin,  outB);<br>}<br><br>// Writes a &quot;brightness&quot; value (0 = off, 255 = full on) to a pin, inverting<br>// it first if the LED is wired common-anode.<br>void writeLED(int pin, int value) {<br>  analogWrite(pin, commonAnode ? 255 - value : value);<br>}</pre><h3>Images</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RNLuG50xL8pT80tjL3UsbQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GgKkI1p_bWR3wogOMAVNXw.jpeg" /></figure><h3>Video</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTosXNTqiGJ8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FTosXNTqiGJ8%3Ffeature%3Dshare&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTosXNTqiGJ8%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5fc373d1edb30872bd37400c4026ff6/href">https://medium.com/media/e5fc373d1edb30872bd37400c4026ff6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de8bd796bfab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adin Gilman-Cohen]]></title>
            <link>https://medium.com/@adin_gilmancohen/adin-gilman-cohen-44edd23f0742?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/44edd23f0742</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 20:56:22 GMT</pubDate>
            <atom:updated>2026-09-03T20:56:22.791Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.adingcdesigns.com/">https://www.adingcdesigns.com/</a></p><p>Hi! My name is Adin Gilman-Cohen. I’m a first year MDes student with my degree in Mechanical Engineering. Outside of school, I’ve worked in solar roofing, optical metrology, and 3D printed drone design at Lawrence Livermore National Laboratory. My skill set revolves around CAD, using machine tools, and 3D printing.</p><p>An object of interest that excites me (and a possible TUI project direction) is my bike. A good road bike has affordances for all the different places you can put your hands on the bars, where to shift, where to store gear, and how to tell when things are going wrong.</p><p>In my free time, I like to play ultimate frisbee, hunt mushrooms, backpack, climb and cook. I also make knives and lamps!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTEiUhuglc-3rLl0DRVbaQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44edd23f0742" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab 1- Dual LED Morse Code Generator with Arduino]]></title>
            <link>https://medium.com/@adin_gilmancohen/lab-1-dual-led-morse-code-generator-with-arduino-e8ad52b002b8?source=rss-ebf339ee554c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8ad52b002b8</guid>
            <dc:creator><![CDATA[Adin Gilmancohen]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 20:36:30 GMT</pubDate>
            <atom:updated>2026-09-03T20:39:15.961Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setup</h3><ul><li>Green LED and red LED</li><li>Two 220 Ohms-resistor</li><li>Breadboard</li><li>Wires</li><li>USB-C Connector</li></ul><h3>Description</h3><p><strong>Internal and external LED - The Basics</strong></p><p>For our first lab assignment, our goal was to make an LED blink with Arduino UNO R4 Minima. I downloaded Arduino IDE, and ran the “Blink” library file to blink the built in LED on the board. Next I used a schematic from an Arduino forum to build the circuit shown below to blink an external green LED.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPrE1iVWupVUwhodjJnMGQ.png" /><figcaption>Schematic from <a href="https://docs.arduino.cc/built-in-examples/basics/Blink/">https://docs.arduino.cc/built-in-examples/basics/Blink/</a></figcaption></figure><p><strong>Morse Code External LED</strong></p><p>In the MDes Masters program Foundations of Technology class, we have been studying the theory of information communication. I decided to use Claude to help me write code to accept a text inut on my laptop and output the message as a morse code message flashed on the LEDs. Once this worked with the circuit shown above, I decided to add a layer of complexity by making the dots in the code red and the dashes green for improved ease of reading. I added a second LED as shown in the photo below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibXoHIJps0_Sw_GF_Oz67A.jpeg" /></figure><p>I read through the Claude code to understand what each line was doing. The code ran as written on the first try as shown below.</p><pre>// Morse Code Two-Color LED Flasher for Arduino Uno R4 Minima<br>// Dots flash on one LED, dashes flash on another.<br>// Type a message into the Serial Monitor and press Enter.<br><br>const int DOT_LED_PIN = 8;   // LED for dots  (e.g., green)<br>const int DASH_LED_PIN = 9;  // LED for dashes (e.g., red)<br><br>// Timing unit in milliseconds. Standard Morse ratios:<br>// dot = 1 unit, dash = 3 units, gap between symbols = 1 unit,<br>// gap between letters = 3 units, gap between words = 7 units<br>int unitTime = 150;<br><br>struct MorseCode {<br>  char letter;<br>  const char* code;<br>};<br><br>// Morse code lookup table (A-Z, 0-9)<br>const MorseCode morseTable[] = {<br>  {&#39;A&#39;, &quot;.-&quot;},    {&#39;B&#39;, &quot;-...&quot;},  {&#39;C&#39;, &quot;-.-.&quot;},  {&#39;D&#39;, &quot;-..&quot;},<br>  {&#39;E&#39;, &quot;.&quot;},     {&#39;F&#39;, &quot;..-.&quot;},  {&#39;G&#39;, &quot;--.&quot;},   {&#39;H&#39;, &quot;....&quot;},<br>  {&#39;I&#39;, &quot;..&quot;},    {&#39;J&#39;, &quot;.---&quot;},  {&#39;K&#39;, &quot;-.-&quot;},   {&#39;L&#39;, &quot;.-..&quot;},<br>  {&#39;M&#39;, &quot;--&quot;},    {&#39;N&#39;, &quot;-.&quot;},    {&#39;O&#39;, &quot;---&quot;},   {&#39;P&#39;, &quot;.--.&quot;},<br>  {&#39;Q&#39;, &quot;--.-&quot;},  {&#39;R&#39;, &quot;.-.&quot;},   {&#39;S&#39;, &quot;...&quot;},   {&#39;T&#39;, &quot;-&quot;},<br>  {&#39;U&#39;, &quot;..-&quot;},   {&#39;V&#39;, &quot;...-&quot;},  {&#39;W&#39;, &quot;.--&quot;},   {&#39;X&#39;, &quot;-..-&quot;},<br>  {&#39;Y&#39;, &quot;-.--&quot;},  {&#39;Z&#39;, &quot;--..&quot;},<br>  {&#39;0&#39;, &quot;-----&quot;}, {&#39;1&#39;, &quot;.----&quot;}, {&#39;2&#39;, &quot;..---&quot;}, {&#39;3&#39;, &quot;...--&quot;},<br>  {&#39;4&#39;, &quot;....-&quot;}, {&#39;5&#39;, &quot;.....&quot;}, {&#39;6&#39;, &quot;-....&quot;}, {&#39;7&#39;, &quot;--...&quot;},<br>  {&#39;8&#39;, &quot;---..&quot;}, {&#39;9&#39;, &quot;----.&quot;}<br>};<br><br>const int tableSize = sizeof(morseTable) / sizeof(MorseCode);<br><br>void setup() {<br>  pinMode(DOT_LED_PIN, OUTPUT);<br>  pinMode(DASH_LED_PIN, OUTPUT);<br>  Serial.begin(9600);<br>  while (!Serial) {<br>    ; // wait for serial port to connect (needed on some boards)<br>  }<br>  Serial.println(&quot;Enter a message to flash in Morse code:&quot;);<br>}<br><br>void loop() {<br>  if (Serial.available() &gt; 0) {<br>    String message = Serial.readStringUntil(&#39;\n&#39;);<br>    message.trim();<br>    if (message.length() &gt; 0) {<br>      Serial.print(&quot;Flashing: &quot;);<br>      Serial.println(message);<br>      flashMessage(message);<br>      Serial.println(&quot;Done. Enter another message:&quot;);<br>    }<br>  }<br>}<br><br>void flashMessage(String message) {<br>  message.toUpperCase();<br><br>  for (int i = 0; i &lt; message.length(); i++) {<br>    char c = message[i];<br><br>    if (c == &#39; &#39;) {<br>      // Word gap (7 units). We already added a 3-unit letter gap<br>      // after the previous letter, so add 4 more units here.<br>      delay(unitTime * 4);<br>      continue;<br>    }<br><br>    const char* code = findMorseCode(c);<br>    if (code != nullptr) {<br>      flashCode(code);<br>      delay(unitTime * 3); // gap between letters<br>    }<br>  }<br>}<br><br>const char* findMorseCode(char c) {<br>  for (int i = 0; i &lt; tableSize; i++) {<br>    if (morseTable[i].letter == c) {<br>      return morseTable[i].code;<br>    }<br>  }<br>  return nullptr; // unsupported character (punctuation, etc.)<br>}<br><br>void flashCode(const char* code) {<br>  for (int i = 0; code[i] != &#39;\0&#39;; i++) {<br>    int pin = (code[i] == &#39;.&#39;) ? DOT_LED_PIN : DASH_LED_PIN;<br>    int duration = (code[i] == &#39;.&#39;) ? unitTime : unitTime * 3;<br><br>    digitalWrite(pin, HIGH);<br>    delay(duration);<br>    digitalWrite(pin, LOW);<br>    delay(unitTime); // gap between symbols within a letter<br>  }<br>}<br></pre><p>In this video, you can see an uploaded message of “SOS” flashed on the two LEDs, with dots and dashes signified both by length of flash and by color of LED.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJWyPkPEKI2Q%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fshorts%2FJWyPkPEKI2Q&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJWyPkPEKI2Q%2Fhq2.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b444b03c500b9a578f5bc2ce46a43a7/href">https://medium.com/media/1b444b03c500b9a578f5bc2ce46a43a7/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8ad52b002b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>