Color Sensor

I’m having an issue with all my RVR’s color sensor. Tried to call for info/they said go here for advice. If I change my code to any color will work. If I change to total/will not recognize color from color sensor. Any suggestions?


Hey @smlodzik!

Having RVR change its main LED to the color of the item underneath it is one of my favorite things to do :relaxed: I am so sorry that you are having difficulty implementing it :confused:

What sorts of items are you testing on (“sensing the color of”)? How bright is the environment where you are testing (how much ambient light is there)?

One note I would also make is that lighter colors show up on RVR’s LEDs pretty faintly, which may result in it appearing as though the sensor is not reading a color…

When I run this program:

I get this:

Looking forward to hearing more!!


1 Like

I’m running similar code, and it doesn’t read the color of the supplied color square papers from the box.

I’ve tried all 6 robots/same results. Not sure what is wrong, will try your code.

1 Like

Thanks for your help.

Just tried/and your sample code worked well. Will try to create stops/turns next.


I am also having a problem with trying to get the color sensor to work properly. If I am running the RVR over the swatches, it picks up the colors on a delay. So based on the layout in your video, it will turn green when it is on red.

But I have a question. How sensitive is the sensor for color pick up? If the “onColor” event is looking for R140 G110 B160, would it also catch R154 G114 B173? Those are actual numbers flickering back and forth with the RVR sitting on the Purple card. Might explain why this code isn’t working.


1 Like

Hey @Mr_Jeff!

There are two things I would note about your code:

  1. The delay you are seeing in your RVR picking up the color is likely due to the delays you’ve set. Especially since you’ve set delays of 3s, as opposed to the 1s delay I was using in the example I posted. I ran the code you posted, but with my delays set to 1s AND
  2. I also chose to play random sound and **continue** on color, meaning that my code would play a sound and continue moving forward and back and changing headlight colors. (would this be the desired behavior for you?)

The color sensor will pick up a color that is close to the color you selected, as well as the exact color, itself; thus, the on color event should pick up (make a sound on) both R140 G110 B160 and R154 G114 B173.

Let me know if I am not quite getting the error you are seeing! Additionally, if you would like to post a video of the unexpected behavior you experience, while you can’t upload a video directly, you can post a link to a video (I uploaded mine to Google Photos and posted a link to its location in Google Photos; putting the link on its own line causes the video to display in your message, rather than other users having to click your link to see your video :wink: ).

Looking forward to hearing your thoughts!


1 Like

Hi Kelsey,

Thanks for the reply…

Yes you have the idea correct. When the RVR recognizes the purple color it should make a random sound.

I added the 3 delay because I know the Bolt sometimes has a delayed event response so figured I would give enough time to recognize the color.

I adjusted the code to a 1 sec delay… but still no sound. Then I replicated the code you posted with only play random sound and continue on color added, still no sound. Thanks for the Google Photo idea, below is the video using the code you posted and one of the color flickering issues I am seeing.


1 Like

Hey @Mr_Jeff!

Thank you so much for the videos! I see that your RVR is starting blue, then the LEDs turn off, then it does seem to register subsequent colors; are you starting the program when you start the video? To me, that specific issue looks like the program is just starting after previously having been stopped on blue and, as such, is clearing its LEDs when the program starts, since the RVR is not told what color to display until it has moved and then read a color. Is there another flickering that I am just not picking up on, or does that sound plausible?

In regards to the sound, I see that you are working with the desktop app; have you tried running this program from an iOS or Android device? I had heard that, at one point, the desktop was having trouble running the on color event unless the bot starts on the desired color. I am getting consistent results running the program from my phone and would suggest that you attempt that, if possible, to see if it makes a difference.

I’ll check in with the app team to ensure they are aware that this is still a bug/ a bug that is impacting the customer experience; thank you so so much for bringing it to our attention :relaxed:

Looking forward to hearing the outcome!


1 Like

Hi brightnbubbly,

So I tried on my Android phn… all worked as intended.

To answer your question, I start the video then the program. You can hear the faint click of the mouse. It was placed on the blue square (no particular reason) to begin. The RVR blue color doesn’t initially show when being run from with the phn.

I will keep an eye out for an update for the windows app.

Thank you for your help.