4/29/2024 0 Comments Spiral led christmas tree* (R, G, and B are each calculated separately. * colors, it increases or decreases the value of that color by 1. * reaches the step size appropriate for one of the PinMode(bluPin, OUTPUT) if (DEBUG) /* The next function is calculateVal. PinMode(redPin, OUTPUT) // sets the pins as output Int prevB = bluVal // Set up the LED outputs Int j = 0 // Loop counter for repeat// Initialize color variables Int repeat = 0 // How many times should we loop before stopping? (0 for no stop) Int loopCount = 60 // How often should DEBUG report? Int DEBUG = 0 // DEBUG counter if set to 1, will write values back via serial Int hold = 0 // Optional hold when a color is complete, before the next crossFade Int bluVal = black int wait = 3 // 10ms internal crossFade delay increase for slower fades Int bluPin = 11 // Blue LED, connected to digital pin 11// Color arrays Int redPin = 10 // Red LED, connected to digital pin 9 Int grnPin = 9 // Green LED, connected to digital pin 10 * are a little fussy - the inner workings are explained * The internals of the program aren't complicated, but they Set the DEBUG flag to 1 if you want debugging output to be * program for 'hold' milliseconds when a color is complete, There is an optional 'hold' variable, which pasues the * and make the last color black if you want it to fade out at the end.) * then stop on the last color in the sequence. * if it is set to a number, it will loop that number of times, If 'repeat' is set to 0, the program will loop indefinitely. * practice, the other functions the code is performing slow this * a 'wait' of 10 ms should make a crossFade of ~10 seconds. * sets the approximate duration of a single crossfade. The internal loop runs for 1020 interations the 'wait' variable * you can set the initial color to be any other color The initial color is set to black (so the first color fades in), but * In addition, there are 5 optional settings you can adjust: * Those colors will appear in that order, fading out of * In the main part of the program, you need to list the order * Some common colors are provided below, or make your own * Red is the red LED at full, blue and green off * controlling the red, green and blue LEDs * A color is just an array of three percentages, 0-100, Describe the colors you want to be displayed * To create fades, you need to do two things: ** Code for cross-fading 3 LEDs, red, green and blue (RGB) I ended up using a slow crossfade demo as the base for the tree. Feel free to use a cheapie inline preprogrammed controller like I did on my umbrella instead. I had plenty of these boards left over from other lamp projects. Just had to switch the target programmer and program the chip directly. I could have used an arduino uno and did to make the initial tests using an RGB shield but ended up using a custom single board with a bare Atmega328 chip. This also means a controller will be needed. This means I can have a programmed effect but all leds change color simultaneously. See compliance details for this product (EU Responsible Person). Notice: The LED light is only suitable for drizzling, it is highly recommended to bring it indoors when there is heavy rain or snow outdoors in order to prolong the service life.I decided to use non-addressable RGB leds. Spetebo LED Spiral Christmas Tree Garden Stake 130 cm Decorative Christmas Tree with Fairy Lights Outdoor Garden Christmas Decoration with Power Plug. 1x 6ft LED Christmas Light Coil with Star.1x 4ft LED Christmas Light Coil with Star.1x 3ft LED Christmas Light Coil with Star.Battery Requirement(Each Light): 4x AA Batteries (Not Included).Color Optional: Cool White/ Warm White/ RGBY(Red Green Blue Yellow Color Changing).Low energy consumption with 50,000 hours of LED light life time.Detachable design for space-saving storage.With floor standing base for Great Mobility & Stability.Freely choose the mode to make different effects for various occasions.Combination, Wave, Sequential, Slo-glo, Chase, Slow Fade, Flashing & Steady On.Set of 3 spiral LED Christmas tree with star finial (6ft, 4ft & 3ft in height) Outdoor Solar Pre-Lit LED Spiral Christmas Tree (Set of 2) by Touch of ECO.Perfect for restaurant, cafe, exhibition, garden, patio, balcony, yard and so on. Bring the holiday spirit no matter outdoors or indoors via this brand new Spiral Xmas Trees Set with Battery Powered.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |