asynchronous programming language

Glowscript is a simple yet powerful asynchronous programming language for creating animations on smart LED strips, including DotStars and NeoPixels.


  • A single glowscript program can run 256 independent animation threads and drive over 1000 LEDs.

  • LEDs can be grouped and assigned to multiple animation threads to create complex light patterns.

  • Animation z-ordering allows superimposed animations.

  • Timing instructions permit LED color changes as rapidly as every millisecond or as slowly as every month.

  • Color data compression reduces complex animations to a compact footprint.



syntaxglowImmediate: [led1,led2,…] color
actionInstantly sets the color of the specified LEDs.
e.g. 1glowImmediate: [led5] green
e.g. 2glowImmediate: [led1,led2,led7] red


syntaxglowRamp: [led1,led2,…] color1 to color2 in timeDuration
actionInstantly sets color1 on the specified LEDs, then transitions color1 to color2 over the specified time duration.
e.g. 1glowRamp: [led15,led4] green to blue in 100ms
e.g. 2glowRamp: [led19] red to orange in 5s


syntaxpause: duration
actionPause current thread for the specified duration. Time units can be milli-seconds, seconds, minutes, hours, or ticks. Minimum pause duration is 1 millisecond. Maximum pause duration is 1080 hours (45 days). The pause duration must be a multiple of the device:tickIntervalMillisecs parameter value, which is the time interval between animation update cycles.
e.g. 1pause: 5ms
e.g. 2pause: 30s
e.g. 3pause: 20m
e.g. 4pause: 1h
e.g. 5pause: 40t


syntaxhere: bookmarkName
actionBookmark a location in the current function.
e.g. 1here: strobeStart


syntaxgoto: bookmarkName
actionJump to a bookmark in the current function.
e.g. 1goto: strobeStart


syntaxcall: @targetFunction
actionSynchronously runs the target function (current function pauses until the target function completes).
e.g. 1call: @redStrobeFunction


syntaxcall: @targetFunction (repeat=N)
actionSynchronously runs the target function N times (current function pauses until all repetitions of the target function completes). Using the repeat parameter is optional. Minimum repeat value is 1 (same as omitting repeat parameter). Maximum repeat value is 2 billion. Repeat is used in conjuction with the call instruction.
e.g. 1call: @redStrobeFunction (repeat=50)


syntaxcallAsync: @targetFunc
actionAsynchronously runs the target function (current function continues immediately after launching the target function). The callAsync instruction can be nested at any level of your code.
e.g. 1callAsync: @blueStrobeFunc


syntaxcallAsync: @targetFunc (zOrder=N)
actionAsynchronously runs the target function with a z-order of N (current function continues immediately after launching the target function). When different animation functions act on the same LED(s), the function with the highest z-order controls the LED(s). If threads have the same z-order, then the last-launched thread wins. Z-order values do not need to be consecutive as the compiler uses them as relative values. Using the z-order parameter is optional. Minimum z-order value is 0 (same as omitting z-order parameter). Maximum z-order value is 1000. Z-order is used in conjuction with the callAsync instruction.
e.g. 1callAsync: @blueStrobeFunc (zOrder=2)
e.g. 2callAsync: @lightBeamFunc (zOrder=35)


syntaxdefine: alias='value'
actionSets a user-friendly alias for the specified string value. This helps with readability and code-maintenance.
e.g. 1define: strobeLeds='[2,3,4,5,9]'
e.g. 2define: purple='(255,0,255,1)'

Specifying LEDs
LEDs are specified by their numeric position from the start of the LED strip (i.e. 1,2,3 and so on) in the following format: [1,2,3] or [1-3] or [1,2-3]).

Specifying colors/brightness
A color is specified by its red value (0-255), green value (0-255), blue value (0-255), & brightness value (0-31) in the following format: (redVal, greenVal, blueVal, brightVal).

Case sensitivity
Glowscript is case-insensitive.

See animation samples for further usage examples.