Brainstorming:
I had a hard time coming up with a unique switch idea, but my process entailed coming up with different body parts that can be used to put pieces of metal together. I thought back to a design class I took in the past and how the professor talked about accessible design; she mentioned doors with handles that turn like this which don’t require you to use your hands. You can use your elbow for example to rotate the handle and from there, pull with your elbow as well. Sometimes, when I have dirty hands from eating food, I’ll use my elbow to open doors like this to access the bathroom.
I decided to use my elbow to trigger a switch. I taped a wire to my elbow and had a strip of copper tape on the table. This copper strip had the other part of the circuit taped to it, so as soon as the wire on my elbow comes into contact with the copper strip, a bunch of LEDs should turn on.
My first attempt was a bust. I just took the two wires connected by the buttons and put them together, but I realized that it took a while for the LEDs to turn off. I looked at the serial monitor and saw that the button was technically “on” (1) even after the circuit was broken. I realized after a while that it was because I didn’t ground the circuit. With the button and breadboard, a resistor is connected to the wire and goes to GND.
Failed attempt:
After realizing this, I taped the resistor and second wire together so that the electrons can go to GND and no longer light up the LEDs. Now, the LED immediately turns off after my elbow lifts up.
F I N A L V I D E O:
Similar to our in-class code, but this time, I have 4 LEDs. The Serial.println line is very helpful for debugging!
Serial.println(buttonState); // if button is pressed, turn LED on if (buttonState) { digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level) digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) } // if button is not pressed, turn it off else { digitalWrite(10, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(11, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(12, LOW); // turn the LED on (HIGH is the voltage level) digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level) }
Looking forwards:
I was thinking since I’m using a strip of copper, maybe I can somehow use the distance between the wires on the copper strip to determine which color LED to turn on. It’d be cool if I can measure how far away the wires are from each other on the copper strip using analog read instead of digital.