PARK JAICHANG / Mbed OS Hexi_TSL2561

Dependencies:   TSL2561

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TSL2561.h"
00003 Serial      pc(USBTX, USBRX); // Serial interface
00004 DigitalOut  sensorPowerEn(PTB12);
00005 DigitalOut  led1(LED1);
00006 
00007 TSL2561     lum(PTB1,PTB0);    // TSL2561 SDA, SCL
00008 // main() runs in its own thread in the OS
00009 int main() {
00010     
00011     sensorPowerEn = 0;
00012     pc.baud(115200);
00013     printf("who am i : %d \r\n", lum.who_am_i());
00014 
00015     while (true) {
00016         led1 = !led1;
00017         printf("Illuminance: %+7.2f [Lux]\r\n", lum.lux());
00018         wait(0.5);
00019         
00020     }
00021 }
00022