PKS Color Sensor Driver for XRCU. More...
#include <Color_sensor.h>
Public Member Functions | |
| Color_sensor (const uint32_t init_port) | |
| Creates a Color_sensor object. | |
| bool | begin (const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS) |
| Activates this color sensor. | |
| uint8_t | get_color () |
| Gets a simple color. | |
| rgb_t | get_rgb () |
| Gets the measured color in RGB-888. | |
| hsl_t | get_hsl () |
| Gets the measured color in HSL. | |
| rgbc_t | get_rgbc () |
| Gets the measured color in RGBC. | |
| void | turn_on_light_bulb () |
| Turns on the detector light bulb. | |
| void | turn_off_light_bulb () |
| Turns off the detector light bulb. | |
| void | turn_on_indicator_led () |
| Turns on the indicator LED. | |
| void | turn_off_indicator_led () |
| Turns off the indicator LED. | |
| bool | cal () |
| calibrates the color sensor to provide accurate results (for future compatibility use) | |
Additional Inherited Members | |
Protected Member Functions inherited from Supported_sensor | |
| Supported_sensor () | |
| Creates an object of a supported sensor. | |
Protected Member Functions inherited from Supported_module | |
| Supported_module () | |
| Creates an object of a supported module. | |
PKS Color Sensor Driver for XRCU.
| Color_sensor::Color_sensor | ( | const uint32_t | init_port | ) |
Creates a Color_sensor object.
| init_port | the I2C port connected to this color sensor |
| bool Color_sensor::begin | ( | const uint8_t | init_i2c_address = DEFAULT_I2C_ADDRESS | ) |
Activates this color sensor.
YOU MUST CALL ME IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY. Configures the settings of the I2C bus and the chip.
| init_i2c_address | the 7-bit I2C address of this color sensor |
true if the color sensor is successfully activated, false if activation failed (for future compatibility use) | bool Color_sensor::cal | ( | ) |
calibrates the color sensor to provide accurate results (for future compatibility use)
true if calibration is successful, false if calibration failed | uint8_t Color_sensor::get_color | ( | ) |
| hsl_t Color_sensor::get_hsl | ( | ) |
| rgb_t Color_sensor::get_rgb | ( | ) |
| rgbc_t Color_sensor::get_rgbc | ( | ) |
| void Color_sensor::turn_off_indicator_led | ( | ) |
Turns off the indicator LED.
The indicator led tells what color the sensor has detected.
| void Color_sensor::turn_off_light_bulb | ( | ) |
Turns off the detector light bulb.
The detector light bulb lights up the sample color plate.
| void Color_sensor::turn_on_indicator_led | ( | ) |
Turns on the indicator LED.
The indicator led tells what color the sensor has detected.
| void Color_sensor::turn_on_light_bulb | ( | ) |
Turns on the detector light bulb.
The detector light bulb lights up the sample color plate.