Me: Hi Mom
Mom: Mike! why are you bringing all these wires into my house?
Me: It is just my Arduino
Mom: Arrrr what?
Me: It is my Arduino and my Relay Squid
Mom: SQUID! I ALREADY MADE SQUID!
Me: Where is your tree?
Mom: Oh it's in the living room, come see.
Me: Yes! Yes! this will be perfect!
Ingredients:
An Arduino
A couple spot lights with Red and Green Bulbs
A Relay Squid
Some Wire
And...
A tree with lights
First I distracted my mom
Then I stripped some wire
I used some tape to fasten my Arduino to my Relay Squid
I connected the wires:
Arduino "Gnd" -> Squid "G"
Arduino "5V" -> Squid "V"
Arduino "1" -> Squid "1"
Arduino "2" -> Squid "2"
Arduino "3" -> Squid "3"
Arduino "4" -> Squid "4"
I plugged in the lights into the Relay Squid and plugged the Relay Squid into the wall
I wrote a few lines of code:
#define MULTITREE 1 //Multi color lights wrapped around the tree
#define WHITETREE 2 //White lights wrapped around the tree
#define REDSPOT 3 //Red spotlight shining on the tree
#define GREENSPOT 4 //Green spotlght shining on the tree
void setup()
{
pinMode(MULTITREE, OUTPUT); // set all the pins to outputs
pinMode(WHITETREE, OUTPUT);
pinMode(REDSPOT, OUTPUT);
pinMode(GREENSPOT, OUTPUT);
digitalWrite(MULTITREE, LOW);
digitalWrite(WHITETREE, LOW);
digitalWrite(REDSPOT, LOW);
digitalWrite(GREENSPOT, LOW);
}
void loop()
{
digitalWrite(MULTITREE, HIGH);
delay(500);
digitalWrite(MULTITREE, LOW);
delay(50);
digitalWrite(WHITETREE, HIGH);
delay(500);
digitalWrite(WHITETREE, LOW);
delay(50);
digitalWrite(REDSPOT, HIGH);
digitalWrite(GREENSPOT, HIGH);
delay(500);
digitalWrite(REDSPOT, LOW);
digitalWrite(GREENSPOT, LOW);
delay(50);
}
It only took me 10 minutes...
Merry Christmas! Nice display you built there... I'm jealous :) My family's tree was already too decked out with ornaments... I would have had to take them all down to get parallel access to the different light strings (instead, they're all wired in serial ... boo).
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete