Technology Forum Has Moved!

The FIRST Tech Challenge Technology forum has moved to a new location! Please take a look at our forum blog for links and instructions on how to access the new forum.

The official blog of the FIRST Tech Challenge - a STEM robotics programs for students grades 7-12.

Note that volunteers (except for FTA/WTA/CSA will still access their role specific forum through this site. The blog also outlines how to access the volunteer forums.
See more
See less

Using more than one Modern Robotics color sensor returns 0 for all values

  • Filter
  • Time
  • Show
Clear All
new posts

  • Using more than one Modern Robotics color sensor returns 0 for all values

    Hello all,
    When our team tried to use 2 Modern Robotics color sensors plugged in to the same Device Interface Module and run the default example program (MRRGBExample), all of the values that show up on the telemetry are 0. Is anyone else having this problem and does anyone know how to fix this?

  • #2
    By the way, our code is here:
    package com.qualcomm.ftcrobotcontroller.opmodes;

    public class linedetect extends autoencode {
    public void runOpMode() throws InterruptedException {
    float hsvValues[] = {0F,0F,0F};
    float hsvValues2[] = {0F,0F,0F};
    while (opModeIsActive()) {
    if(gamepad1.x && gamepad1.a && gamepad1.right_bumper)
    Color.RGBToHSV( * 8, * 8, * 8, hsvValues);
    Color.RGBToHSV( * 8, * 8, * 8, hsvValues2);

    telemetry.addData("Clear left", bottomsensorleft.alpha());
    telemetry.addData("Red left",;
    telemetry.addData("Green left",;
    telemetry.addData("Blue left",;
    telemetry.addData("Hue left", hsvValues[0]);

    telemetry.addData("Clear right", bottomsensorright.alpha());
    telemetry.addData("Red right",;
    telemetry.addData("Green right",;
    telemetry.addData("Blue right",;
    telemetry.addData("Hue right", hsvValues2[0]);



    • #3
      Color sensors run off I2C bus. Each I2C device must have a unique I2C address. If you have two of them, they will have the same I2C address. Search the forum for the thread about how to change I2C device address on a device. You need to change one of the two color sensors to a different address.


      • #4
        Wouldn't you be able to do that with setI2cAddress() on the color sensor?


        • #5
          As Mike said, each I2C device must have a unique address; check out the example opmode to do this.
          Rohan Menon
          Programmer, Team 8441


          • #6
            Putting this here, as it took our team a while to figure this out.

            A simple way to change the address on one of your color sensors is to use the Modern Robotics Core Device Discovery application ( Connect the color sensor you want to update to a Core Device Interface module, plug that into your computer's USB, then use the CDD and open the advanced window for the Core Device Interface. Refresh the list of I2C devices, then use the change address controls. Our team (#2997 Beauty Bot and the Beasts) set theirs to 0x70. This change of address will be retained, even when you remove the sensor from power.

            Then, in your code, at the top of your OpMode you'll want to add code like
            where mySecondColorSensor is the variable name to which you've assigned your sensor.

            So, it's actually pretty easy. Our team had a grueling experience due to the fact that they had a bum Core Device Interface module which made everything confusing until they ran through the Modern Robotics hardware troubleshooting guide and found they needed to replace the module. Modern Robotics shipped a replacement for free, quickly. (Thanks, MR!)