TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (387 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (120 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 (140168 times)
  2. FAT32 Library (72622 times)
  3. Network Ethernet Library (57643 times)
  4. USB Device Library (47957 times)
  5. Network WiFi Library (43553 times)
  6. FT800 Library (42942 times)
  7. GSM click (30140 times)
  8. mikroSDK (28670 times)
  9. PID Library (27057 times)
  10. microSD click (26552 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: 4226 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

RS232 SPI Click

0

RS232 SPI Click is based around the MAX3100, a universal asynchronous receiver transmitter (UART) - the first UART specifically optimized for small microcontroller-based systems, from Maxim Integrated. Because of the features contained in its modules, the RS232 SPI Click can be used for handheld instruments, small networks in HVAC or Building control, UART in SPI systems, battery-powered systems, PDAs, notebooks and many more.

[Learn More]

3D Hall 4 Click

0

3D Hall 4 Click is a compact add-on board that can detect the strength of a magnetic field in all three dimensions. This board features the SENM3Dx, a 3D Hall magnetic sensor from SENIS. It is a CMOS-integrated magnetic field sensor that allows the acquisition of all three magnetic field components at the same time and in the same spot. The sensor is equipped with on-chip EPROM to hold initialization, calibration data, and other settings and definitions.

[Learn More]

PIR 2 Click

0

PIR 2 Click is a compact add-on board designed for high-performance motion detection applications. This board features the ZSLM323511, a dual-element balanced differential pyroelectric (PIR) sensor from Zilog. Key features include excellent EMI immunity, a low-profile surface mount package, and a typical field of view of 150 degrees on the X-axis and 139 degrees on the Y-axis. The board also integrates the ZCWM05GIV1 PIR lens for maximum IR transmissivity. Ideal for security systems, lighting control, and video doorbells, PIR 2 Click ensures reliable motion detection in various demanding environments.

[Learn More]