Motoo Tanaka / Mbed 2 deprecated test_S11059

Dependencies:   S11059 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MSS.h"
00003 #include "S11059.h"
00004 
00005 #define MSU_S11059_ADDRESS 0x2A
00006 
00007 int main(void) 
00008 {
00009     uint16_t uR, uG, uB, uIR ;
00010     uint8_t ctrl ;
00011 
00012     S11059 *s11059 = new S11059(PIN_SDA, PIN_SCL, MSU_S11059_ADDRESS) ;
00013     printf("=== test S11059 for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
00014     printf("     R,      G,      B,     IR\n") ;
00015     
00016     while(1) {
00017         ctrl = 0x89 ; // ADC reset, High Gain, integration time 1.4ms 
00018         s11059->setControl(ctrl) ;
00019         ctrl = 0x09 ; // Release ADC reset, High Gain, integration time 1.4ms 
00020         s11059->setControl(ctrl) ; // start measure 
00021         wait(0.02) ;
00022         s11059->getRData(&uR) ;
00023         s11059->getGData(&uG) ;
00024         s11059->getBData(&uB) ;
00025         s11059->getIRData(&uIR) ;
00026         printf("%6d, %6d, %6d, %6d\n", uR, uG, uB, uIR) ;
00027         wait(1) ;
00028     }
00029 }