MatrixMiniR4 1.1.9
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
HTColV2 Class Reference

Class for HiTechnic NXT Color Sensor V2 functions. More...

#include <MiniR4_HTColV2.h>

Public Member Functions

void begin ()
 Initialize the color sensor.
 
void setMode (uint8_t mode=HTCOLV2_MODE_RGB)
 Set the sensor mode.
 
uint8_t getColorNumber ()
 Get the color number detected by the sensor.
 
uint8_t getR ()
 Get the red component value.
 
uint8_t getG ()
 Get the green component value.
 
uint8_t getB ()
 Get the blue component value.
 
void getRGB (uint8_t &r, uint8_t &g, uint8_t &b)
 Get all RGB values at once.
 
float getH ()
 Get the hue value (H in HSV)
 
float getS ()
 Get the saturation value (S in HSV)
 
float getV ()
 Get the brightness/value (V in HSV)
 
void getHSV (float &h, float &s, float &v)
 Get all HSV values at once.
 

Public Attributes

uint8_t _ch = 0
 I2C multiplexer channel.
 
TwoWire * _pWire
 Pointer to Wire object.
 

Detailed Description

Class for HiTechnic NXT Color Sensor V2 functions.

Definition at line 38 of file MiniR4_HTColV2.h.

Member Function Documentation

◆ begin()

void HTColV2::begin ( )

Initialize the color sensor.

Definition at line 18 of file MiniR4_HTColV2.cpp.

◆ getB()

uint8_t HTColV2::getB ( )

Get the blue component value.

Returns
Blue value (0-255)

Definition at line 101 of file MiniR4_HTColV2.cpp.

◆ getColorNumber()

uint8_t HTColV2::getColorNumber ( )

Get the color number detected by the sensor.

Returns
Color number (0-17, different colors have different numbers)

Definition at line 83 of file MiniR4_HTColV2.cpp.

◆ getG()

uint8_t HTColV2::getG ( )

Get the green component value.

Returns
Green value (0-255)

Definition at line 95 of file MiniR4_HTColV2.cpp.

◆ getH()

float HTColV2::getH ( )

Get the hue value (H in HSV)

Returns
Hue value (0-360 degrees)

Definition at line 115 of file MiniR4_HTColV2.cpp.

◆ getHSV()

void HTColV2::getHSV ( float & h,
float & s,
float & v )

Get all HSV values at once.

Parameters
hReference to store hue value
sReference to store saturation value
vReference to store brightness value

Definition at line 136 of file MiniR4_HTColV2.cpp.

◆ getR()

uint8_t HTColV2::getR ( )

Get the red component value.

Returns
Red value (0-255)

Definition at line 89 of file MiniR4_HTColV2.cpp.

◆ getRGB()

void HTColV2::getRGB ( uint8_t & r,
uint8_t & g,
uint8_t & b )

Get all RGB values at once.

Parameters
rReference to store red value
gReference to store green value
bReference to store blue value

Definition at line 107 of file MiniR4_HTColV2.cpp.

◆ getS()

float HTColV2::getS ( )

Get the saturation value (S in HSV)

Returns
Saturation value (0-100%)

Definition at line 122 of file MiniR4_HTColV2.cpp.

◆ getV()

float HTColV2::getV ( )

Get the brightness/value (V in HSV)

Returns
Brightness value (0-100%)

Definition at line 129 of file MiniR4_HTColV2.cpp.

◆ setMode()

void HTColV2::setMode ( uint8_t mode = HTCOLV2_MODE_RGB)

Set the sensor mode.

Parameters
modeSensor mode (RGB=0, PASSIVE=1, RAW=3)

Definition at line 25 of file MiniR4_HTColV2.cpp.

Member Data Documentation

◆ _ch

uint8_t HTColV2::_ch = 0

I2C multiplexer channel.

Definition at line 56 of file MiniR4_HTColV2.h.

◆ _pWire

TwoWire* HTColV2::_pWire

Pointer to Wire object.

Definition at line 57 of file MiniR4_HTColV2.h.


The documentation for this class was generated from the following files: