We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-06-25
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 4601 times
Not followed.
License: MIT license
Color 6 click is a very accurate color sensing Click board which features the AS73211, an XYZ true color sensor from ams.
Do you want to subscribe in order to receive notifications regarding "Color 6 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Color 6 click" changes.
Do you want to report abuse regarding "Color 6 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in the register. The library includes the function for configuration chip for measurement, functions for reading temperature, channel (X or Y or Z) data. The user also has the function float color6_convertingToEe(uint8_t channel, uint16_t MRES_data)
which converts channel data to Ee (Input light irradiance regarding to the photodiode’s area within the conversion time interval) data.
Key functions:
uint16_t color6_readData(uint8_t reg)
- Functions for reading data from registerfloat color6_convertingToEe(uint8_t channel, uint16_t MRES_data)
- Functions for converting channel data to Ee data.void color6_goToMeasurementMode()
- Functions for go to measurement mode.float color6_getTemperature()
- Functions for reading temperature in ℃.Example description
The application is composed of three sections:
void applicationTask() { mikrobus_logWrite(" Channel X : ",_LOG_TEXT); X_data = color6_readData(_COLOR6_MREG_MEASUREMENT_X_CHANNEL ); IntToStr(X_data, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" Ee X channel data: ",_LOG_TEXT); Ee_data = color6_convertingToEe(_COLOR6_MREG_MEASUREMENT_X_CHANNEL, X_data); FloatToStr(Ee_data, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" Channel Y : ",_LOG_TEXT); Y_data = color6_readData(_COLOR6_MREG_MEASUREMENT_Y_CHANNEL ); IntToStr(Y_data, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" Ee Y channel data: ",_LOG_TEXT); Ee_data = color6_convertingToEe(_COLOR6_MREG_MEASUREMENT_Y_CHANNEL, Y_data); FloatToStr(Ee_data, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" Channel Z : ",_LOG_TEXT); Z_data = color6_readData(_COLOR6_MREG_MEASUREMENT_Z_CHANNEL ); IntToStr(Z_data, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" Ee Z channel data: ",_LOG_TEXT); Ee_data = color6_convertingToEe(_COLOR6_MREG_MEASUREMENT_Z_CHANNEL, Z_data); FloatToStr(Ee_data, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" Temperature : ",_LOG_TEXT); temperature = color6_getTemperature(); FloatToStr(temperature, dataText); mikrobus_logWrite(dataText, _LOG_LINE); mikrobus_logWrite(" ",_LOG_LINE); Delay_ms( 2000 ); }
Other MikroElektronika libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.