TOP Contributors

  1. MIKROE (2641 codes)
  2. Alcides Ramos (347 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (136216 times)
  2. FAT32 Library (69477 times)
  3. Network Ethernet Library (55703 times)
  4. USB Device Library (45989 times)
  5. Network WiFi Library (41638 times)
  6. FT800 Library (40779 times)
  7. GSM click (28787 times)
  8. PID Library (26327 times)
  9. mikroSDK (26051 times)
  10. microSD click (25138 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: 3588 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

AM/FM click

0

AM/FM Click is a RADIO RECEIVER click board™ that can be used to listen to music from the AM and FM radio bands.

[Learn More]

DC MOTOR 7 click

0

DC MOTOR 7 click is a dual brushed DC motor driving Click board™, featuring the advanced PWM chopper-type integrated DC motor driver, labeled as TB67H400AFTG.

[Learn More]

Ambient 10 click

0

Ambient 10 Click is a compact add-on board used to sense the amount of the present ambient light. This board features the APDS-9006-020, analog-output ambient light photosensor from Broadcom Limited.

[Learn More]