Tutorial #1: How to create a blinking Christmas tree
Christmas is coming and everybody has started to prepare and celebrate. But don't forget that also the makers celebrate but with their own touch.
We'll show you today how create a blinking Christmas Tree with an Arduino Mega but you can also do it with an Uno (Can't find my Uno) and a few LED.
Materiels:
- A breadboard
- a bunch of wires
- A 220ohm resistor
- A dozen of LED
Let's folow the next schematic that you can find on our by clicking on that link: Github
We'll put all the wires from pin 32 to 37 on the differents anodes of our leds.
The cathodes will be connected together and wired to the 220 hom resistor which is connected to the Arduino pin number 31.
Just remember that the LED shape should looks like a Christmas tree. :-).
Let's your imagination do the rest. You can have a look of mine.
The program is pretty simple. He makes the christmas tree blink on different ways by changing voltage (High or Low) on the LED cathode and anode.
The program for the arduino can be find by clicking on this link: Blinking_christmas_tree_arduino
PROGRAM:
void setup() { // put your setup code here, to run once: pinMode(31, OUTPUT); digitalWrite(31, HIGH); for(int i=32; i<38; i++) { pinMode(i, OUTPUT); } } void loop() { // put your main code here, to run repeatedly: digitalWrite(31, LOW); for (int a=1; a<4; a++) { for(int i=32; i<38; i++) { digitalWrite(i, HIGH); delay(100); digitalWrite(i, LOW); } } for (int b=1; b<4; b++) { for(int i=38; i>31; i--) { digitalWrite(i, HIGH); delay(100); digitalWrite(i, LOW); } } }
I Hope you enjoyed this small project.
You can modify it, leave comments and share it.
If you want more, you can subscribe to our youtube channel and social networks, Facebook, Twitter, Google+ and Instagram.
See you soon for more DIY projects.