Lights control the color and brightness of LEDs.
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.
Use the following examples to set the main LED to the same green from the image of the block above:
JavaScript: setMainLed({ r: 90, g: 255, b: 90 })
Python: set_main_led({ 'r': 90, 'g': 255, 'b': 90 })
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
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. Generally, setting the main LED will set the color for all available LEDs for compatible robots.
Fades the main LED lights from one color to another over a specified duration. For BOLT, this fades the color of the 8x8 LED matrix.
To fade from green to blue over 3 seconds, use the following example:
JavaScript: await fade({ r: 0, g: 255, b: 0 }, { r: 0, g: 0, b: 255 }, 3.0)
Python: await fade({ 'r': 0, 'g': 255, 'b': 0 }, { 'r': 0, 'g': 0, 'b': 255 }, 3.0)
Parameters:
fromColor {{ r: number; g: number; b: number }} - An object containing the starting RGB color values for the fade (0 to 255 per color channel)
toColor {{ r: number; g: number; b: number }} - An object containing the ending RGB color values for the fade (0 to 255 per color channel)
duration {number} - The transition time in seconds
Repeatedly blinks the main LED lights or the full 8x8 LED matrix on Sphero BOLT. 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.
To strobe green 15 times in 3 seconds, use the following examples:
JavaScript: await strobe({ r: 255, g: 57, b: 66 }, (3 / 15) * 0.5, 15)
Python: await strobe({ 'r': 255, 'g': 57, 'b': 66 }, (3 / 15) * 0.5, 15)
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
period {number} - The time in seconds the light stays on during a single blink
count {number} - The total number of blinks
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:
JavaScript: setFrontLed({ r: 239, g: 0, b: 255 })
Python: set_front_led({ 'r': 239, 'g': 0, 'b': 255 })
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
Supported Robots:
BOLT, BOLT+, RVR, RVR+, R2-D2, R2-Q5
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:
JavaScript: setLeftHeadlightLed({ r: 253, g: 159, b: 255 })
Python: set_left_headlight_led({ 'r': 253, 'g': 159, 'b': 255 })
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
Supported Robots:
RVR, RVR+
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:
JavaScript: setRightHeadlightLed({ r: 0, g: 28, b: 255 })
Python: set_right_headlight_led({ 'r': 0, 'g': 28, 'b': 255 })
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
Supported Robots:
RVR, RVR+
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:
JavaScript: setLeftLed({ r: 0, g: 255, b: 34 })
Python: set_left_led({ 'r': 0, 'g': 255, 'b': 34 })
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
Supported Robots:
BOLT+, RVR, RVR+
Changes the color of the LED on the right 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:
JavaScript: setRightLed({ r: 255, g: 18, b: 0 })
Python: set_right_led({ 'r': 255, 'g': 18, 'b': 0 })
Parameters:
color {{ r: number; g: number; b: number }} - An object containing the RGB color values (0 to 255 per color channel)
Supported Robots:
BOLT+, RVR, RVR+
Changes the color of the LED on the back of the robot. Set this using RGB (red, green, blue) values on a scale of 0 - 255. Sphero BOLT, BOLT+, and RVR/RVR+ have an RGB LED on the back, whereas previous Sphero robots are limited to blue only.
For example, the above green color is expressed as:
JavaScript: setBackLed({ r: 0, g: 255, b: 0 })
Python: set_back_led({ 'r': 0, 'g': 255, 'b': 0 })
Parameters:
colorOrBrightness {{ r: number; g: number; b: number }|number} - The RGB color or the desired brightness (0 to 255)
Supported Robots:
BOLT, BOLT+, RVR, RVR+, R2-D2, R2-Q5
Changes the brightness of the LED on the back of the robot (aiming LED). This LED is limited to blue only, with a brightness scale from 0 to 255.
To set the back (aim) LED to full brightness, use the following examples:
JavaScript: setBackLed(255)
Python: set_back_led(255)
Parameters:
colorOrBrightness {{ r: number; g: number; b: number }|number} - The RGB color or the desired brightness (0 to 255)
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:
JavaScript: setDomeLeds(15)
Python: set_dome_leds(15)
Parameters:
brightness {number} - The brightness level, from 0 to 15
Compatible Robots:
BB-9E
Changes the brightness of the Holographic Projector white LED, from 0 to 255.
For example, set it to full brightness using:
JavaScript: setHoloProjectorLed(255)
Python: set_holo_projector_led(255)
Parameters:
brightness {number} - The brightness level, from 0 to 255
Compatible Robots:
R2-D2, R2-Q5
Changes the brightness of the Logic Display LEDs, from 0 - 255.
For example, set them to full brightness using:
JavaScript: setLogicDisplayLeds(255)
Python: set_logic_display_leds(255)
Parameters:
brightness {number} - The brightness level, from 0 to 255
Compatible Robots:
R2-D2, R2-Q5