Program that runs lux sensor

Dependencies:   TSL2561_library mbed

main.cpp

Committer:
eawendtjr
Date:
2015-08-04
Revision:
1:0045a40107a0
Parent:
0:2aa94ec9943c

File content as of revision 1:0045a40107a0:

#include "mbed.h"
#include "TSL2561.h"

Serial pc(USBTX, USBRX);

TSL2561 luxsensor(p22, p20);

/*void setup(void) 
{
    pc.baud(9600);
    
    if (luxsensor.begin())
    {
        pc.printf("Found Sensor\r\n");
    }
    else
    {
        pc.printf("No Sensor\r\n");
        //while(1);
    }
}*/
  
  

int main() {
    
    //setup();
    
    luxsensor.setGain(TSL2561_GAIN_16X);
    luxsensor.setTiming(TSL2561_INTEGRATIONTIME_13MS);
    
    while(1) {   
    uint16_t vis = luxsensor.getLuminosity(TSL2561_VISIBLE);
    pc.printf("%d luminosity\r\n", vis);
    wait(1);
    }
}