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

Main LED

5 mled

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(getRandomColor()) chooses a random color value from the full spectrum of 0-255 on each color channel. If used in a loop you can expect the RGB values to be different each time through the loop. Also see the Color Operators and Color Varaiables.

Back LED

5 bled

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);


5 fade

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)


5 strobe

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

5 dome led

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


5 psi led front

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.


5 psi bled

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

5 hp 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

5 logic d led

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).


5 sound

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

5 r2 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

*R2-Q5 Droid Sounds are not available


5 speak

await speak() will speak a string 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 command 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, booleans, or colors. The wait/continue playback (true/false boolean) 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).