TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139568 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57256 times)
  4. USB Device Library (47631 times)
  5. Network WiFi Library (43222 times)
  6. FT800 Library (42566 times)
  7. GSM click (29932 times)
  8. mikroSDK (28292 times)
  9. PID Library (26934 times)
  10. microSD click (26309 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

Color 5 click

Rating:

5

Author: MIKROE

Last Updated: 2018-07-27

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optical

Downloaded: 4108 times

Not followed.

License: MIT license  

Color 5 click is a color sensing Click board, which utilizes the P12347-01CT, integrated color sensing device, which can sense red (R), green (G), and blue (B) component of the light, providing measurement via I2C interface.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Color 5 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Color 5 click" changes.

Do you want to report abuse regarding "Color 5 click".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Color 5 click

Color 5 click

Native view of the Color 5 click board.

View full image
Color 5 click

Color 5 click

Front and back view of the Color 5 click board.

View full image

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 a function to read the color through a red, green, and blue filter and IR data. The user can set the color of the LEDs. The sensor has a proximity mode with which it can detect the object in front of the sensor. The user has a function for reading light through one filter as well as reading the light through all the filters.

Key functions:

  • void color5_setConfiguration(uint8_t reg, uint8_t _data) - Functions for configuration sensor
  • void color5_setLedDriver(uint8_t red, uint8_t green, uint8_t blue) - Functions for setting led color
  • uint16_t color5_readData(uint8_t reg) - Functions for reading data from register
  • uint8_t color5_getInterrupt() - Functions for proximity detect

Example description

The application is composed of three sections :

  • System Initialization - Initializes I2C module
  • Application Initialization - Initializes driver init and configuration proximity and led driver
  • Application Task - (code snippet) - Reads the color values through a red, blue, green filter and IR data. Checking that the proximity sensor detects the object.
void applicationTask()
{
 // Color init
 color5_setConfiguration(_COLOR5_REG_RGB_SENSOR_CTRL,
                         _COLOR5_CFG_SENSOR_RESET 
                       | _COLOR5_CFG_MANUAL_SETTINGS_MODE );
 color5_setConfiguration(_COLOR5_REG_RGB_SENSOR_CTRL, 
                         _COLOR5_CFG_LOW_GAIN 
                      | _COLOR5_CFG_MANUAL_SETTINGS_MODE );

 RED_Data = color5_readData( _COLOR5_REG_OUT_DATA_RED_MSB );
 IntToStr( RED_Data, dataTxt );
 mikrobus_logWrite( "RED data : ", _LOG_TEXT );
 mikrobus_logWrite( dataTxt, _LOG_TEXT );
 mikrobus_logWrite( " nm", _LOG_LINE );

 GREEN_Data = color5_readData( _COLOR5_REG_OUT_DATA_GREEN_MSB );
 IntToStr( GREEN_Data, dataTxt );
 mikrobus_logWrite( "GREEN data : ", _LOG_TEXT );
 mikrobus_logWrite( dataTxt, _LOG_TEXT );
 mikrobus_logWrite( " nm", _LOG_LINE );

 BLUE_Data = color5_readData( _COLOR5_REG_OUT_DATA_BLUE_MSB );
 IntToStr( BLUE_Data, dataTxt );
 mikrobus_logWrite( "BLUE data : ", _LOG_TEXT );
 mikrobus_logWrite( dataTxt, _LOG_TEXT );
 mikrobus_logWrite( " nm", _LOG_LINE );

 IR_Data = color5_readData( _COLOR5_REG_OUT_DATA_IR_MSB );
 IntToStr( IR_Data, dataTxt );
 mikrobus_logWrite( "IR data : ", _LOG_TEXT );
 mikrobus_logWrite( dataTxt, _LOG_TEXT );
 mikrobus_logWrite( " nm", _LOG_LINE );

 mikrobus_logWrite("---------------rn", _LOG_LINE);


 if (color5_getInterrupt() == 1)
 {
 mikrobus_logWrite("Proximity detect", _LOG_LINE);
 }
 Delay_ms( 500 );
}

Other mikroE Libraries used in the example:

  • Conversions
  • I2C
  • UART

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

3D Motion click board - Example

1

3D Motion click carries Microchip’s MM7150 9-axis sensor fusion motion module. It’s a complete self contained solution comprising a 3-axis accelerometer, a gyroscope, a magnetometer, and a SSC7150 motion coprocessor. Example displays data acquired from the sensors on TFT display.

[Learn More]

Smart DOF 2 Click

0

Smart DOF 2 Click is a compact add-on board with a highly advanced integrated 6-axis IMU measurement unit. This board features the LSM6DSV16XTR, a high-performance 6-axis IMU with sensor fusion, ASC, MLC, Qvar, and OIS/EIS paths from STMicroelectronics. The IMU unit features an accelerometer and gyroscope that can be turned off independently of each other, still allowed to have different ODRs and power modes. The unit can be configured as a finite state machine (FSM), machine learning core (MLC), and Qvar sensing.

[Learn More]

Compass 5 click

5

Compass 5 Click is a compact add-on board that contains a 3-axis magnetometer device suitable for compass application. This board features the AK09918C, a 3-axis electronic compass with high sensitive Hall sensor technology from AKM Semiconductor.

[Learn More]