Configuring the Processor
NodeMCU 1.0 (ESP-12… should be displayed. If your processor is plugged in and it’s serial port is selected then this text should be shown in BOLD. If you have just plugged the processor in then it may take a few seconds to find it and highlight the text. If it doesn’t do this then click Tools, then Port: and click on what should be the only serial port, assuming your computer doesn’t have any extra ports, in which case you will have to decide the correct one.
You should then be able to load the program with the sample configuration by clicking on the upload button under the ellipse marked 2. Have a good look at the patterns you see on your lights and try to come to a bit of an understanding of how they are behaving in relation to the configuration settings above, that start after ellipse 4.
The current setting for the maximum power that the lights will use is 500ma. You can change the value here by changing the number, or commenting out this line and uncommenting the one above it (yes // denotes the start of a comment), adjusting the MAX_MA value to correspond to your power supply.
Here you set NUM_LEDS to the number of LEDs (Lights) in your string.
If you change the configuration to something that is invalid, the first two lights will alternate flashing RED. Hopefully the error will be obvious, if it isn’t, perhaps you can press ^Z (Control and Z) until your recent changes have been undone and slowly work up to the desired change, correctly. If that fails you can uncomment the define DEBUG line and load this code, pressing Control-Shift-M, to bring up the terminal window, after you see the “Hard resetting via RTS pin...” message. You should then get a couple of lines that describe the error with your config file. If you get several lines of meaningless English repeated rapidly, then it would appear you have the same Arduino bug as I do, in this case simply unplug the processor, wait a few seconds and then plug it back in, this time the messages should appear correctly. Note that you will have to press Control-Shift-M again (his time to close the terminal window), before you can load your code again.
After ellipse 4 is the configuration proper, at least one line is required for each light, extra lines are for extra patterns for lights that have Next not set to NO_NEXT. Note the count, in the square braces after led_cfgs is set to NUM_LEDS+2, this is because the last light has a chain of 2 Nexts.
Note the comment immediately underneath ellipse 4, it shows the order of the parameters for each light, the extra spacing is simply for neatness.
Here is a description of what each parameter means and how they relate to other parameters.
Type
lt_Candle. The LED simulates a candle, it varies from Yellow to Red (though Orange) and flickers and fades randomly, as if there is a gentle variable breeze. Group, InitialyOn, Colour/Sequence and Delay are set to N/A, Duration and Next are generally set to INFINITE and NO_NEXT, but this isn’t compulsory.
lt_Star. The LED twinkles like a star, it varies from White to Blue in colour. Essentially this type uses the TwinkleFox BlueWhite colour pattern, but is set to twinkle faster than normal, and is prevented from going ‘off’. TGroup, InitialyOn, Colour/Sequence and Delay are set to N/A, Duration and Next are generally set to INFINITE and NO_NEXT, but this isn’t compulsory.
lt_Constant. The LED is on permanently in the specified colour.
lt_ChaseColorMove. The LEDs in the group chase each other, along with the colour.
lt_ChaseColorStatic. The LEDs in the group chase each other, each LED stays its initial colour from the config.
lt_RoundChaseColorMove. The LEDs in the group chase each other, along with the colour, the chase uses every other LED in the group, and is thus the preferred chase mechanism for table runner type displays.
lt_RoundChaseColorStatic. The LEDs in the group chase each other, each Led stays its initial colour from the config, the chase uses every other LED in the group, and is thus the preferred chase mechanism for table runner type displays.
lt_Blink. The LEDs blink at a rate defined by Delay
lt_Twinkle. The LEDs turn on and off randomly, after every Delay a random choice is made as to whether to leave the LED on, or turn it off.
lt_TwinkleFox. The LEDs twinkle in and out with varying colors from the chosen palette.
Group
Some Types need to be grouped together as the changing of one either affects, or is affected by the rest of the LEDs in the group. All LEDs in a group must have the same type. Lt_Star, lt_TwinkleFox and all the Chase types must have groups.
InitiallyOn
Some types can have their initial status set to on(true) or off(false). This is normally set to on(true) for lt_Constant, but can be set false if you want a LED to always be off. For Chase types you set it to indicate the number of LEDs on at the start of the chase, and hence the number on after every chase movement.
Colour/Sequence
For Constant, Star, Blink, Twinkle and Chase types this is the colour to be used for the LED. Colours are specified as CRGB:: followed by one of the following :
AliceBlue, Amethyst, AntiqueWhite, Aqua, Aquamarine, Azure, Beige, Bisque, Black, BlanchedAlmond, Blue, BlueViolet, Brown, BurlyWood, CadetBlue, Chartreuse, Chocolate, Coral, CornflowerBlue, Cornsilk, Crimson, Cyan, DarkBlue, DarkCyan, DarkGoldenrod, DarkGray, DarkGrey, DarkGreen, DarkKhaki, DarkMagenta, DarkOliveGreen, DarkOrange, DarkOrchid, DarkRed, DarkSalmon, DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkSlateGrey, DarkTurquoise, DarkViolet, DeepPink, DeepSkyBlue, DimGray, DimGrey, DodgerBlue, FairyLight, FireBrick, FloralWhite, ForestGreen, Fuchsia, Gainsboro, GhostWhite, Gold, Goldenrod, Gray, Grey, Green, GreenYellow, Honeydew, HotPink, IndianRed, Indigo, Ivory, Khaki, Lavender, LavenderBlush, LawnGreen, LemonChiffon, LightBlue, LightCoral, LightCyan, LightGoldenrodYellow, LightGreen, LightGrey, LightPink, LightSalmon, LightSeaGreen, LightSkyBlue, LightSlateGray, LightSlateGrey, LightSteelBlue, LightYellow, Lime, LimeGreen, Linen, Magenta, Maroon, MediumAquamarine, MediumBlue, MediumOrchid, MediumPurple, MediumSeaGreen, MediumSlateBlue, MediumSpringGreen, MediumTurquoise, MediumVioletRed, MidnightBlue, MintCream, MistyRose, Moccasin, NavajoWhite, Navy, OldLace, Olive, OliveDrab, Orange, OrangeRed, Orchid, PaleGoldenrod, PaleGreen, PaleTurquoise, PaleVioletRed, PapayaWhip, PeachPuff, Peru, Pink, Plaid, Plum, PowderBlue, Purple, Red, RosyBrown, RoyalBlue, SaddleBrown, Salmon, SandyBrown, SeaGreen, Seashell, Sienna, Silver, SkyBlue, SlateBlue, SlateGray, SlateGrey, Snow, SpringGreen, SteelBlue, Tan, Teal, Thistle, Tomato, Turquoise, Violet, Wheat, White, WhiteSmoke, Yellow or YellowGreen.
Other possible colours can be Candle, Tungsten40W, Tungsten100W, Halogen, CarbonArc, HighNoonSun, DirectSunlight, OvercastSky, ClearBlueSky, WarmFluorescent, StandardFluorescent, CoolWhiteFluorescent, FullSpectrumFluorescent, GrowLightFluorescent, BlackLightFluorescent, MercuryVapor, SodiumVapor, MetalHalide or HighPressureSodium. In this case the CRGB:: is not required.
If those options make it too hard to find the colour you want, head over to https://www.rapidtables.com/web/color/RGB_Color.html use the ‘RGB color picker’ to select your desired colour, then copy the code after the # and paste it as the colour, prefixing it with ‘0x’ (eg 0x43B78D ).
For the TwinkleFox type, this is the TwinkleFox group of colours to be used. Possible values are :-
TwinkleFoxRed. A twinkling pattern containing only red
TwinkleFoxLime. A twinkling pattern containing only lime (in computer colours, lime is more green than green, crazy eh)
TwinkleFoxRetroC9. A twinkling pattern shifting through ‘historical’ C9 light colours, Red, Orange, Green, Blue and White
TwinkleFoxBlueWhite. Mostly Blue with White accents
TwinkleFoxRainbowClrs. Colours of the rainbow
TwinkleFoxFairyLight. A fairy light palette with some brightness variations
TwinkleFoxRGW. Mostly Red with Green and White, Christmassy
TwinkleFoxPartyClrs. Blue, Pink,Red, Orange and Yellow, ramped
TwinkleFoxRedWhite. Red and White (Candy cane)
TwinkleFoxSnow. Various snowflake like colours
TwinkleFoxHolly. Holly Red and Holly Green
TwinkleFoxIce. ‘Cold Icy’ pale blue
TwinkleFoxCloud. Blue and White shades.
TwinkleFoxLava. Yellow, Red and White shades.
TwinkleFoxOcean. White, Blue and Purple shades
TwinkleFoxForest. Green, White, Blue and Red shades
TwinkleFoxRainbowStripe. Rainbow with black gaps
TwinkleFoxHeat. Yellow, Orange and Red shades
Delay
For Types Blink, Twinkle and the Chasers (first entry only used) the delay between changes in milliseconds.
Duration
Each LED can change Types, after a given period of time, Duration is the period of time, in milliseconds for which the current type ‘runs’ before progressing to the next Type. All Types for any LED must be either grouped, or not grouped.
Next
After the duration expires this is the number of the next Type for this LED. NO_NEXT is used to indicate either continuously using the one Type, or that the next type is the first type. The second and subsequent Type for any LED can be shared amongst multiple LEDs, if such a sharing is useful.