Lights

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

Main LED

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

For Sphero RVR/RVR+, the main LED consists of all front, back and side LEDs (5 total groupings of LEDs). For Sphero BOLT+, the main LED consists of 6 LEDs - two on the front, two on the back, and two on the left and right side respectively. 

Random Color

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. On Sphero BOLT, this command sets all 64 pixels on the LED matrix to the specified color. Also see the Color Operators and Color Variables.

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

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

Front LED

setFrontLed() changes the color of the front LED light. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above magenta color is expressed as setFrontLed({ r: 239, g: 0, b: 255 }). Supported with Sphero BOLT, BOLT+, and RVR/RVR+.

Left Headlight LED

setLeftHeadlightLed() changes the color of the front left headlight LED on Sphero RVR/RVR+. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above pink color is expressed as setLeftHeadlightLed({ r: 253, g: 159, b: 255 }). Supported with Sphero RVR/RVR+ only.

Right Headlight LED

setRightHeadlightLed() changes the color of the front right headlight LED on Sphero RVR/RVR+. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above blue color is expressed as setRightHeadlightLed({ r: 0, g: 28, b: 255 }). Supported with Sphero RVR/RVR+ only.

Left LED

setLeftLed() changes the color of the LED on the left side of the robot. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above green color is expressed as setLeftLed({ r: 0, g: 255, b: 34 }). Supported with Sphero BOLT+ and RVR/RVR+.


Right LED

setRightLed() changes the color of the LED on the left side of the robot. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above red color is expressed as setRightLed({ r: 255, g: 18, b: 0 }). Supported with Sphero BOLT+ and RVR/RVR+.

Back LED

setBackLed() changes the color of the back LED light, aka the "Tail Light" or "Aim Light." Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above green color is expressed as setBackLed({ r: 0, g: 255, b: 0 }). Sphero BOLT, BOLT+, and RVR/RVR+ have an RGB LED on the back, whereas previous Sphero robots are limited to blue only. Supported with Sphero BOLT, BOLT+, and RVR/RVR+.

Back LED - Blue Only

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 - 255. For example, use setBackLed(255) to set the back LED to full brightness. Use await delay() to set it 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);


Note:
Sphero BOLT, BOLT+, and RVR/RVR+ have an RGB LED for their back LED, which means you can set a specific color. For example, setBackLed({ r: 0, g: 255, b: 0 }) turns the back LED green on BOLT, BOLT+, and RVR/RVR+. 

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. We don't use 0 - 255 for this light because it has less granular control. For example, set them to full brightness using setDomeLeds(15).

R2-D2 & R2-Q5 Lights

Front LED

setFrontLed() changes the color of the front LED light. Set this using RGB (red, green, blue) values on a scale of 0 - 255. For example, the above fuchsia color is expressed as setFrontLed({ r: 232, g: 0, b: 255 }).

Back LED

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

Holo Projector LED

setHoloProjectorLed() changes the brightness of the Holographic Projector white LED, from 0 - 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 - 255. For example, set them to full brightness using setLogicDisplayLeds(255).