Idea:
My idea was inspired by a childhood memory that I think a lot of us will resonate with. You know when you used to put your feet up on the table as a child and your moms face would just turn red and she would yell at you to take you feet off of her coffee table. In this production the led light will turn red as soon as I put my feet on the coffee table 🙂
Implementation:
I attached one jumper cable to the digital input PIN number 10 and connected it with the positive terminal on the led light, while the short leg (negative terminal) is connected to ground through a 330 ohm resistor.The “switch” in this case were two jumper cables (stuck to the table) where when they touch the foil wrapped around my leg, make the led light up. One of the jumper cables was connected to another jumper cable that is connected to PIN number 2. While the other jumper cable that the “switch” consisted off was connected another jumper cable that was connected to ground. Hence, pin 10 is two turn the led on and off while pin 2 will check if the foil has pin touched or not.
Code:
void setup() { pinMode(10,OUTPUT); pinMode(2,INPUT_PULLUP); } void loop() { if(digitalRead(2)==LOW){ digitalWrite(10,HIGH); } if(digitalRead(2)==HIGH){ digitalWrite(10,LOW); } }
Final project: