Week 8 Unusual Switch

Code Link:

https://github.com/lonussss/Intro-to-IM/blob/25ad7a56cd164118742c7f7bec29d9868ff476be/unusual_switch.ino

Concept: 

This idea is distantly inspired by how cars warn you when your seatbelt is not attached. I was inspired by the concept of leds lighting up or not lighting up based on humans interactions with chairs.

How I proceeded was adapting the code and circuit from the in-class example to fit my needs. I replaced the switch with 2 wires attached to 2 pieces of tin-foil, one attached to my chair, and one attached to my shirt.

The LED lights up when i lean back on my chair, and turns off when I’m not leaning back on my chair.

IMG_3267

Code Highlights: 

The code that controls the output pretty much is the same as the in-class exercise, where when the circuit is connected, the led lights up, and when it is closed, the led dims.

int buttonState = digitalRead(A2);

if (buttonState == HIGH) {

digitalWrite(13, HIGH);

} else {

digitalWrite(13, LOW);

 

Improvements: 

Currently, I’m using 2 pieces of tin foil loosely attached to my shirt and to my chair, for the future, something like this could be implemented with a pressure sensor of sorts, where it can determine how much pressure I am applying on the chair, which could affect the brightness of the LED. This would not only be better in terms of not needing conductive material but it also increases functionality.

Leave a Reply