Arduino Nano RGB Sensor Control Code

RGB Sensors are capable to read the brightness of the 3 basic colors: Red, Green and Blue. Most RGB reader device can light the surface with a few white LEDs. On some boards you can turn On or Off the LEDs. The libraries support TCS3200 and TCS3210 chips, so the only thing that matters is that the board contains one of these chips. RGB sensors can easily connect to Ozeki 10 if you use the following wiring and upload the code below.

arduino nano with rgb sensor
Figure 1 - Arduino Nano with RGB Sensor

Required hardware

  • Arduino Nano
  • RGB Sensor

Source code to install on controller


Before you upload this code to your Arduino, please format the EEPROM...
#include <OzIDManager.h>
#include <OzRGB_Sensor.h>

OzIDManager* manager;
OzRGB_Sensor* RGB_sensor;

void setup() 
{
  Serial.begin(115200);

  manager = new OzIDManager;
  manager->_sendACK = true;
  manager->_checksum = true;

  OzCommunication::setIDManager(manager);

  //S0, S1, S2, S3, OE, sensorOut
  RGB_sensor = new OzRGB_Sensor(2, 3, 4, 5, 7, 8);

  int x=1;
  manager->sendLinkSetup();
  manager->PrintWelcomeLine(RGB_sensor, x++, "MyRGB_Sensor");
}

void loop()
{
  OzCommunication::communicate();
  RGB_sensor->ownLoop();
}

More information