This year we put Arduino Uno-powered lights on our tree, and my crowning achievement (so far!) is to make it snow on the tree!
This display creates 'flakes' at the top of the tree, simulates them fluttering down, and piling up in snowdrifts at the bottom. The bottom row slowly melts, making way for more snow!
The hard part was figuring out the ratio of lights in each ring. To do that, I used a temporary bit of code that let me move a 'cursor' around the tree, lighting up one LED at a time. It used Serial.read() so I could use the '-' and '=' keys to move it around, and printed out the current light number so I could record it. This let me create a 'vertical' line up one side of the tree, starting at light 0.
Using those ratios, every time a snowflake needs to 'drop' down, I know how many lights to move it to give the illusion of vertical movement!
Comments
Please log in or sign up to comment.