TOP Contributors

  1. MIKROE (2655 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 (136781 times)
  2. FAT32 Library (69979 times)
  3. Network Ethernet Library (55948 times)
  4. USB Device Library (46274 times)
  5. Network WiFi Library (41888 times)
  6. FT800 Library (41184 times)
  7. GSM click (28987 times)
  8. PID Library (26419 times)
  9. mikroSDK (26373 times)
  10. microSD click (25382 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

Spectral 2 click

Rating:

5

Author: MIKROE

Last Updated: 2018-03-28

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optical

Downloaded: 4290 times

Not followed.

License: MIT license  

Spectral 2 click is a multispectral color sensing device, which uses the state-of-the-art sensor IC for a very accurate color sensing.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Spectral 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Spectral 2 click" changes.

Do you want to report abuse regarding "Spectral 2 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

Spectral 2 click

Spectral 2 click

Native view of the Spectral 2 click board.

View full image
Spectral 2 click

Spectral 2 click

Front and back view of the Spectral 2 click board.

View full image

Library Description

This library will allow you to read the RGB values from the Spectral 2 click board sensor.

Key functions:

  • void spectral2_reset() - Function for doing a software reset on the sensor.
  • void spectral2_Configuration(uint8_t _data) - This function is used for configuring different operation modes of the sensor.
  • float spectral2_getCalibratedData(uint8_t dataReg) - Function for reading the RGB values depending on the parameter passed.

Examples Description

The demo application is composed of three sections:

  • System Initialization - Initializes I2C module, RST pin as OUTPUT and INT pin as INPUT.
  • Application Initialization - Driver initialize, reset module and configuration measurement.
  • Application Task - (code snippet) - Reads the brightness value with R, G, B, I, O and V filter, every 1 second, and logs on to USBUART..
void applicationTask()
{
 mikrobus_logWrite("-------------------",_LOG_LINE);

 fData = spectral2_getCalibratedData(_SPECTRAL2_CALIBRATED_DATA_R);
 FloatToStr(fData,fText);
 mikrobus_logWrite("-- R ( Red data ) :",_LOG_TEXT);
 mikrobus_logWrite(fText,_LOG_LINE);

 fData = spectral2_getCalibratedData(_SPECTRAL2_CALIBRATED_DATA_G);
 FloatToStr(fData,fText);
 mikrobus_logWrite("-- G ( Green data ) :",_LOG_TEXT);
 mikrobus_logWrite(fText,_LOG_LINE);

 fData = spectral2_getCalibratedData(_SPECTRAL2_CALIBRATED_DATA_B);
 FloatToStr(fData,fText);
 mikrobus_logWrite("-- B ( Blue data ) :",_LOG_TEXT);
 mikrobus_logWrite(fText,_LOG_LINE);

 fData = spectral2_getCalibratedData(_SPECTRAL2_CALIBRATED_DATA_Y);
 FloatToStr(fData,fText);
 mikrobus_logWrite("-- Y ( Yellow data ) :",_LOG_TEXT);
 mikrobus_logWrite(fText,_LOG_LINE);

 fData = spectral2_getCalibratedData(_SPECTRAL2_CALIBRATED_DATA_O);
 FloatToStr(fData,fText);
 mikrobus_logWrite("-- O ( Orange data ) :",_LOG_TEXT);
 mikrobus_logWrite(fText,_LOG_LINE);

 fData = spectral2_getCalibratedData(_SPECTRAL2_CALIBRATED_DATA_V);
 FloatToStr(fData,fText);
 mikrobus_logWrite("-- V ( Violet data ) :",_LOG_TEXT);
 mikrobus_logWrite(fText,_LOG_LINE);

 Delay_1sec();
}

mikroE Libraries used in the example:

  • UART Library
  • Conversions Library
  • C_String Library
  • I2C Library

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.

ALSO FROM THIS AUTHOR

HAPTIC click

0

This application generate vibrations from the lower frequency range of the audio input

[Learn More]

Pressure 14 click

0

Pressure 14 Click is a compact add-on board that contains a board-mount pressure sensor. This board features the ABP2LANT060PG2A3XX, a piezoresistive silicon pressure sensor offering a digital output for reading pressure over the specified full-scale pressure span and a temperature range from Honeywell Sensing and Productivity Solutions. This I2C configurable sensor is calibrated and temperature compensated for sensor offset, sensitivity, temperature effects, and accuracy errors, including non-linearity, repeatability, and hysteresis, using an on-board ASIC. This Click board™ is suitable for pressure measurements in automotive applications, industrial and consumer applications.

[Learn More]

Accel 6 click

0

Accel 6 click is a three-axis acceleration sensor with many features. It uses the BMA280, a 14bit triaxial acceleration sensor with intelligent on-chip motion triggered interrupt controller, from Bosch Sensortec.

[Learn More]