TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 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 (136876 times)
  2. FAT32 Library (70003 times)
  3. Network Ethernet Library (55999 times)
  4. USB Device Library (46305 times)
  5. Network WiFi Library (41927 times)
  6. FT800 Library (41208 times)
  7. GSM click (29012 times)
  8. PID Library (26423 times)
  9. mikroSDK (26398 times)
  10. microSD click (25386 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 8 click

Rating:

5

Author: MIKROE

Last Updated: 2018-10-29

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optical

Downloaded: 3608 times

Not followed.

License: MIT license  

Color 8 click is a color-sensing Click board™, a part of our sensor Click board line. Sensing the color by utilizing ROHM’s BH1749NUC, an integrated color sensor IC, it comes in the package which also includes the mikroSDK software, a library with all the functions.

No Abuse Reported

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

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

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

  • mikroSDK Library 2.0.0.0
  • 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 8 click

Color 8 click

Native view of the Color 8 click board.

View full image
Color 8 click

Color 8 click

Front and back view of the Color 8 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 register and reads data from register. The library includes function for configuration chip for measurement, function for reads one color and functions for light color value is received by calculating RGB value and conversions in HSL value. The user also has the function color8_getColor() which checks the color of the light.

Key functions:

  • void float color8_getColorValue() - Functions for read color value in HSL
  • void uint8_t color8_getColor(float color_value) - Function for set output voltage

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes I2C module and sets INT pin as INPUT
  • Application Initialization - Initialization driver init and device configuration for start measurement
  • Application Task - (code snippet) - Reads RED, GREEEN, BLUE and IR data. Converts data to HSL value and return detect color. For a successful color test, place a click near the color of the monitor and detect the color on the screen.
void applicationTask()
{
    RED_data = color8_readData(_COLOR8_REG_RED_DATA);
    IntToStr(RED_data, demoText);
    mikrobus_logWrite(" RED data : ", _LOG_TEXT);
    mikrobus_logWrite(demoText, _LOG_LINE);
    
    GREEN_data = color8_readData(_COLOR8_REG_GREEN_DATA);
    IntToStr(GREEN_data, demoText);
    mikrobus_logWrite(" GREEN data : ", _LOG_TEXT);
    mikrobus_logWrite(demoText, _LOG_LINE);
    
    BLUE_data = color8_readData(_COLOR8_REG_BLUE_DATA);
    IntToStr(BLUE_data, demoText);
    mikrobus_logWrite(" BLUE data : ", _LOG_TEXT);
    mikrobus_logWrite(demoText, _LOG_LINE);
    
    IR_data = color8_readData(_COLOR8_REG_IR_DATA);
    IntToStr(IR_data, demoText);
    mikrobus_logWrite(" IR data : ", _LOG_TEXT);
    mikrobus_logWrite(demoText, _LOG_LINE);
    
    colorValue = color8_getColorValue();
    FloatToStr(colorValue, demoText);
    mikrobus_logWrite(" HSL color value : ", _LOG_TEXT);
    mikrobus_logWrite(demoText, _LOG_LINE);
    
    isColor = color8_getColor(colorValue);
    
    switch(isColor)
    {
        case 1:
        {
            mikrobus_logWrite("--- Color: ORANGE ", _LOG_LINE);
            break;
        }
        case 2:
        {
            mikrobus_logWrite("--- Color: RED ", _LOG_LINE);
            break;
        }
        case 3:
        {
            mikrobus_logWrite("--- Color: PINK ", _LOG_LINE);
            break;
        }
        case 4:
        {
            mikrobus_logWrite("--- Color: PURPLE ", _LOG_LINE);
            break;
        }
        case 5:
        {
            mikrobus_logWrite("--- Color: BLUE ", _LOG_LINE);
            break;
        }
        case 6:
        {
            mikrobus_logWrite("--- Color: CYAN ", _LOG_LINE);
            break;
        }
        case 7:
        {
            mikrobus_logWrite("--- Color: GREEN ", _LOG_LINE);
            break;
        }
        case 8:
        {
            mikrobus_logWrite("--- Color: YELLOW ", _LOG_LINE);
            break;
        }
        default:
        {
            break;
        }
    }
    Delay_100ms();
    
    mikrobus_logWrite("  ", _LOG_LINE);
    Delay_ms( 1000 );
}


Other mikroE Libraries used in the example:

  • I2C

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

TDC 2 click

0

TDC 2 Click is a compact add-on board that recognizes events and provides a digital representation of the time they occurred. This board features ScioSense’s AS6500, a four-channel time-to-digital converter (TDC) frontend with high measurement performance and high data throughput. The AS6500 is characterized by simple data post-processing thanks to calibrated results (calculates calibrated stop measurements referenced to the applied reference clock).

[Learn More]

Tester click

0

Each pin of the mikroBUS™ is routed to a red colored LED, which is protected by 1K resistor.

[Learn More]

RFID click

0

RFid click features CR95HF 13.56 MHz contactless transceiver as well as trace antenna.

[Learn More]