Anki Vector Cube Colors SDK

We will show you how to shine the lights in Vector’s Cube at 6 different colors using the Anki Vector SDK in Python.

Anki Vector’s Cube

Vector has a cube that he can play with. The cube has lights which are RGB LEDs which can display multiple colors.

You have probably seen these lights turn on in Vector’s cube when he is doing his thing.

We will be writing a program so Vector’s cube can shine at different colors.

Illuminating Commands

This is a fairly straight forward program that we’ll be writing. Let’s take a look at the commands we’ll be using.

  • anki_vector.lights.red_light (as well as other colors)
  • time.sleep()

Not a ton going on here. So we can jump in to the code.

Coding the Cube

A Python program makes Vector's cube show multiple colors with RGB LED Kinvert

Again this is a shorter program than usual. We wrote this with the Anki Vector SDK in Python.

We do the usual imports with anki_vector and time. However this time to keep things a little cleaner we did from anki_vector import lights.

The main function is called and we connect to the cube.

The colors are set. Currently I can only get the cubes to shine at these 6 colors instead of full Rainbow Cubes like with Cozmo.

We sweep through these 6 colors 5 different times, and we have Vector set the lights for his cube to those colors.

At the end, we make sure to turn the lights off on the cubes with cube.set_lights_off().

Here is the code:

Copyright Kinvert All Rights Reserved
If you would like to use this code for
business or education please contact
us for permission at:
Free for personal use
import anki_vector
from anki_vector import lights
import time

def main():
    with anki_vector.Robot() as robot:
        print("It might take a while to connect to the Cube")
        while not
            print("No Cube Yet...")
        cube =
        colors = [ lights.red_light,
                lights.magenta_light ]

        for j in range(5):
            for color in colors:
if __name__ == "__main__":

Hopefully that makes sense. If not, you can always copy and paste the code to use it yourself.

Improving the Cube Code

One thing we will be doing is getting this to work as RGB.

In the past we made Rainbow Eyes for Vector With Hue. This is a little different than directly setting RGB values

We also looked at the pixels on Vector’s screen which is related to RGB. You can find that at

As for the code, let’s look at a few other things.

How would you shine a white light?

What if you wanted the lights to shine a color for longer, or for less time?

Is there a way to make each corner of the cube a different color?

Beyond Vector’s Cube and Lights

If you found this interesting we write about a lot of similar stuff at Kinvert.

We have also written about Cozmo Vs Vector and the Anki Cozmo SDK.

We have many Cozmo Examples and Vector Examples, as well as Games You Can Play With Vector.

If Python isn’t your thing check out What is Robotics, Block Coding, and Age to Teach Kids Python.

Finally, we have a mailing list with lots of great tips and tricks on Vector as well as Cozmo if you want. You can unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *