Program that runs lux sensor
Dependencies: TSL2561_library mbed
Diff: main.cpp
- Revision:
- 0:2aa94ec9943c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Aug 04 17:15:16 2015 +0000 @@ -0,0 +1,37 @@ +#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); + } +} \ No newline at end of file