Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Defines | Functions | Variables

hitechnic-colour-v2.h File Reference

HiTechnic Color Sensor V2 driver. More...

#include "common.h"
#include "common-light.h"

Go to the source code of this file.

Defines

#define HTCS2_I2C_ADDR   0x02
#define HTCS2_CMD_REG   0x41
#define HTCS2_OFFSET   0x42
#define HTCS2_COLNUM_REG   0x00
#define HTCS2_RED_REG   0x01
#define HTCS2_GREEN_REG   0x02
#define HTCS2_BLUE_REG   0x03
#define HTCS2_WHITE_REG   0x04
#define HTCS2_COL_INDEX_REG   0x05
#define HTCS2_RED_NORM_REG   0x06
#define HTCS2_GREEN_NORM_REG   0x07
#define HTCS2_BLUE_NORM_REG   0x08
#define HTCS2_RED_MSB   0x00
#define HTCS2_RED_LSB   0x00
#define HTCS2_GREEN_MSB   0x00
#define HTCS2_GREEN_LSB   0x00
#define HTCS2_BLUE_MSB   0x00
#define HTCS2_BLUE_LSB   0x00
#define HTCS2_WHITE_MSB   0x00
#define HTCS2_WHITE_LSB   0x00
#define HTCS2_MODE_ACTIVE   0x00
#define HTCS2_MODE_PASSIVE   0x01
#define HTCS2_MODE_RAW   0x03
#define HTCS2_MODE_50HZ   0x35
#define HTCS2_MODE_60HZ   0x36

Functions

int HTCS2readColor (tSensors link)
bool HTCS2readRGB (tSensors link, int &red, int &green, int &blue)
bool HTCS2readHSV (tSensors link, float &hue, float &saturation, float &value)
bool HTCS2readWhite (tSensors link, int &white)
bool HTCS2readNormRGB (tSensors link, int &red, int &green, int &blue)
bool HTCS2readRawRGB (tSensors link, bool passive, long &red, long &green, long &blue)
bool HTCS2readRawWhite (tSensors link, bool passive, long &white)
bool _HTCSsendCommand (tSensors link, byte command)
int HTCS2readColor (tMUXSensor muxsensor)
bool HTCS2readRGB (tMUXSensor muxsensor, int &red, int &green, int &blue)
bool HTCS2readHSV (tMUXSensor muxsensor, float &hue, float &saturation, float &value)
int HTCS2readColorIndex (tSensors link)

Variables

tConfigParams HTCS2_config = {HTSMUX_CHAN_I2C, 4, 0x02, 0x42}
tByteArray HTCS2_I2CRequest
tByteArray HTCS2_I2CReply
signed byte active_mode [4] = {-1, -1, -1, -1}

Detailed Description

HiTechnic Color Sensor V2 driver.

HTCS22-driver.h provides an API for the HiTechnic Color Sensor driver.

Changelog:

Credits:

License: You may use this code as you wish, provided you give credit where its due.

THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.

Author:
Xander Soldaat (xander_at_botbench.com)
Date:
27 April 2011
Version:
0.4

Definition in file hitechnic-colour-v2.h.