Back to Parent

Outcome


Outcome

    • Practice exercise for learning to use button and potentiometer
    • A simple device for the table: DND and okay to disturb signal using flex sensor, Switch and LED.

Process

  • I had a hard time making any exercise work in the first go because of consistently dropping Wi-fi. But once that was fixed, it became much smoother work.
  • We learnt the void blinkLED function in Lab Session 4 which I decided to try out in this assignment for blinking the LED. I decided to use this in the loop as a part of conditional logic and write code on my own based on what I think might be logical. This kept giving me an error that I was unable to resolve on my own.


Reflection

  • The first time I was connecting, I had forgotten to use jumper wires to power the whole circuit. It's so easy to get caught up and excited about engaging with the input and output because of which I made multiple mistakes in setting up the circuit.
  • Writing code on your own without an exact reference is hard. I wanted to make sure I'm getting the basics right instead of just copying code and it took me multiple trials and errors and multiple hours, despite which I couldn't get it right. Following is the code I couldn't get to work, hence I decided to design something different for exercise. If you spot my mistake and know how to fix it, please comment and let me know.  
  • int flexPin = A0;

    int flexReading = 0;

    int ledPin = D2;

    int ledBrightness = 0;

    void setup() {

    pinMode(ledPin, OUTPUT);

    Particle.variable("snoopy", flexReading );

    }

    void loop() {

    flexReading = analogRead(flexPin);

    ledBrightness = map(flexReading, 0, 4095, 0, 255);

    analogWrite(ledPin, ledBrightness);

    delay(100);

    }

Exercise 1: Controlling LED brightness with a Potentiometer

Show Advanced Options
Show Advanced Options
Show Advanced Options

Exercise 2: Using Flex Sensor to indicate availability

Use Scenario

When I'm working on my desk in the studio, I often get disturbed by peers wanting to chat or ask a question. This sometimes breaks my flow of work and I would really appreciate a subtle way of communicating when is it okay for someone to disturb me and when it's an absolute DND. Therefore, I hope to design a phone holder that gives out warnings when I pick up the phone.

Input:

- Switch: turn the light system on/off

- Flex Sensor (FSR): sense the bend

Output:

- Switch: turn the light system on/off

- (when the flex sensor is bent halfway): low brightness of LED

- (when the flex sensor is all the way): high brightness of LED

Show Advanced Options
Show Advanced Options
Drop files here or click to select

You can upload files of up to 20MB using this form.