Description
Create an unusual switch that doesn’t require the use of your hands. Use Arduino digital input and output for the interaction.
Process
So, I was just sitting on my chair trying to think about what to make. I got the idea, why don’t I just make something that involves sitting on the chair. So here it goes.
I used two LEDs ( red and blue). I used 3 resistors ( two 330 v and one 10k) to control the flow of electricity. I used basic conductors wires and jumper twins to finish the circuit. I connected the Red LED to Digital Input 13, Blue LED to Digital Input 12. I connected the switch to 7.
I connected the copper wires to the copper tape to give it a bigger surface area to conduct electricity.
This is the final video of me testing out the product:-
The code was pretty simple.
HERE IT GOES:-
const int ledRed = 13; const int switch1 = 7; const int ledBlue = 12; bool currentState = false; bool switchState = LOW; void setup() { // put your setup code here, to run once: pinMode(ledRed, OUTPUT); pinMode(ledBlue, OUTPUT); pinMode(switch1, INPUT); } void loop() { ///put your main code here, to run repeatedly: switchState = digitalRead(switch1); if (currentState != switchState ){ digitalWrite(ledBlue, LOW); digitalWrite(ledRed, HIGH); } else { digitalWrite(ledBlue, HIGH); digitalWrite(ledRed, LOW); } }