Lights control the color and brightness of LEDs on a robot.

Main LED


setMainLed changes the color of the main LED light. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the below green color is expressed as setMainLed({ r: 90, g: 255, b: 90 }):

setMainLed({ r: Math.round(Math.random() * 255), g: Math.round(Math.random() * 255), b: Math.round(Math.random() * 255) }); chooses a random color value from the full spectrum of 0.0-255.0. If used in a loop you can expect the RGB values to be different each time through the loop. In the block canvas, the Randomize toggle on the color picker has the same effect. Also see the Color Operator and Color Varaiables.

Back LED


setBackLed sets the brightness of the back aiming LED, aka the "Tail Light". This LED is limited to blue only, with a brightness scale from 0 to 255. For example, use setBackLed(255) to set the back LED to full brightness. Use await delay() to set the backLed on for a duration. For example, to create a dim and a bright blink sequence use:

setBackLed(0);  // Dim
await delay(0.33);
setBackLed(255);  // Bright
await delay(0.33);



await fade changes the main LED lights from one color to another over a period of seconds. For example, to fade from green to blue over 3s, use: await fade({ r: 0, g: 255, b: 0 }, { r: 0, g: 0, b: 255 }, 3.0)



await strobe repeatedly blinks the main LED lights. The period is the time, in seconds, the light stays on during a single blink; cycles is the total number of blinks. The time for a single cycle is twice the period (time for a blink plus the same amount of time for the light to be off). Another way to say this is the period is 1/2 the time it takes for a single cycle. So, to strobe green 15 times in 3 seconds, use: await strobe({ r: 255, g: 57, b: 66 }, (3 / 15) * 0.5, 15);

BB-9E Lights

Dome LEDs


setDomeLeds() controls the brightness of the two single color LEDs (red and blue) in the dome, from 0 to 15. For example, set them to full brightness using setDomeLeds(15).

R2-D2 & R2-Q5 Lights



setFrontPsiLed() changes the color of the Front Process Status Indicator (PSI) LED light. For example, set it to blue using setFrontPsiLed({ r: 0, g: 0, b: 255 }). R2-D2’s normal “in-character” pattern for this light is blinking from blue to red.



setBackPsiLed() changes the color of the Back Process Status Indicator (PSI) LED light. For example, set it to yellow using setBackPsiLed({ r: 255, g: 255, b: 0 }). R2-D2’s normal “in-character” pattern for this light is blinking from yellow to green.

Holo Projector LED


setHoloProjectorLed() changes the brightness of the Holographic Projector white LED, from 0 to 255. For example, set it to full brightness using setHoloProjectorLed(255).

Logic Display LEDs


setLogicDisplayLeds() changes the brightness of the Logic Display LEDs, from 0 to 255. For example, set it to full brightness using setLogicDisplayLeds(255).


Control sounds and words which can play from your programming device's speaker or the robot (R2-D2 only).



await plays a sound from your programming device. When a sound is played, using the true boolean (aka: "Wait" in the block canvas) makes the program wait until the sound plays completely before continuing to the next command. Change to false (aka: "Continue" in the block canvas) to go to the next command immediately. If you want to use timing different than the wait/continue commands allow, you can follow a true (continue) command with a delay() command so the subsequent logic is delayed for the given duration.

You can randomize all sounds by not declaring a Category and SoundName, such as await If you declare a Category but leave the SoundName blank it will randomize in the given category, such as await as used in the Animal Toss Game.

Preview all of sounds below, or you can hear them in the blocks canvas in the app:

Droid Sound


Unique Star Wars Droid Sounds are available for BB-8, BB-9E and R2-D2 using The droid names are written as BB8, BB9E, R2D2 and R2Q5 and they can only be played on the intended Droid. This works the same as the sound command, except that the wait and continue boolean is not available. For example, to play the R2-D2 Burnout sound use R2D2.Sound.General.Burnout.

*R2-Q5 Droid Sounds are not available



await speak() will speak text from your programming device using the text-to-speech engine, in any language supported by your device. You can add a lot of interesting logic to your programs with this command. For example, in the Magic 8-Ball program you can change the speak block to some fun answers like await speak("Never in a million years", true). You can also concatenate string values (see the + button on the block canvas) to make them dynamic. The additional values can be variables, parameters, or sensors, and/or in the form of numbers, strings, or colors. The playback (true/false) is handled the same as the Play Sound command. For example, to speak the current heading use await speak(buildString("The heading is" + Math.round(getHeading())), true).