Color sensors on Robocore

Hi,

we are currenty trying to use color sensor in our project, but we can’t make it work. We are using HiTecnic Color V2 sensor and we are doing the following actions:

  1. Create new project
  2. Configure and make sure that the connection is working
  3. Copy code from hSensors/hitechnic_colorv2.cpp at master · husarion/hSensors · GitHub
  4. Transfer it to robocore, and console log prints always the same rgb values
    Any ideas why?

The sensor might be broken, and if thats the case we have Lego RGB sensor too, but we cant find any code example of how to use it with robocore, do you have any?

Thanks a lot in advance

Hi PatrykW,

I check what you asked and HiTecnic works perfectly fine with this code.

Before we will come to conclusion that your sensor is broken i have to be sure that:

  • You change BOARD_TYPE in VSC to robocore (Ctrl+Shift+P > Change Husarion project variables > BOARD_TYPE > robocore)
  • Your robocore works fine ( Flash very easy program for example only with toggling LED)
  • You also have to remember that this sensor is not the highest quality, so object have to be really close.

We don’t have library for Lego RGB sensor, but you can easily create it. If you will have problem with this we will help you :wink:

Regards,
Hubert

Hi,

thanks for your answer!

Seems like the sensor is broken :frowning:
We also tried to create library for Lego RGB, but we’r not really good at it and it didn’t work. We would love some help if you can.

Best regards
Patryk

Hi PatrykW,

I’ve tried to find register for Lego RGB, but I can’t find anything. You already tried to create this lib, so I’m guessing you found it. Can you share it with me?

Regards,
Hubert

We tried to create it from scratch, but it didn’t work. We have changed the sensor to HiTechnic EOPD and we managed to recognize 3 colors, which is enough for us.

Best regards
Patryk

1 Like