Unusual Switch – Drink Me
For this assignment, I really struggled being creative, maybe because I’m fasting 🙂
I explored various metals in my room to discover a novel method for illuminating an LED. Eventually, I decided to use a metal straw as the conductor between two wires. By placing it in a cup and using my mouth to press the straw onto the wires, the LED lights up.
This is what my Arduino looked like:
Those two white wires were taped on the table, very close to each other but not touching.
I covered it with a cup to create the effect of drinking.
My niece volunteered to demonstrate this project. This is the LINK to the video
Lastly, this is my code:
const int ledPin = 2; // Use pin 2 to control the LED const int touchPin = 7; // Use pin 7 to read the touch state void setup() { pinMode(ledPin, OUTPUT); // Initialize the LED pin as an output pinMode(touchPin, INPUT_PULLUP); // Initialize the touch pin as an input with internal pull-up resistor } void loop() { int touchState = digitalRead(touchPin); // Read the state of the touch pin if (touchState == LOW) { // If wire A touches the wire on line 5, it will be LOW digitalWrite(ledPin, HIGH); // Turn on the LED } else { digitalWrite(ledPin, LOW); // Turn off the LED } }
I really enjoyed making this switch, and seeing it work at the end was truly rewarding.