Shane Barton
/
sbart_lightsense_kl46z
HW_5.2
Fork of lightsense_kl46z_basic by
Diff: main.cpp
- Revision:
- 10:49cb7dc6b36c
- Parent:
- 9:f619cdaa7a65
--- a/main.cpp Fri Sep 09 19:41:10 2016 +0000 +++ b/main.cpp Mon Sep 19 06:01:15 2016 +0000 @@ -2,7 +2,7 @@ #include "SLCD.h" -#define PROGNAME "lightsense_kl46z_basic v1\n\r" +#define PROGNAME "sbart_lightsense_kl46z pt1\n\r" #define DATATIME 400 // milliseconds #define LCDLEN 10 #define LIGHTSENSORPORT PTE22 @@ -24,7 +24,9 @@ AnalogIn LightSensor(LIGHTSENSORPORT); float lightData; char lcdData[LCDLEN]; - + PwmOut gled(LED_GREEN); + PwmOut rled(LED_RED); + int timeToChangeDF = DATATIME; LEDTimer.start(); LEDTimer.reset(); @@ -32,9 +34,11 @@ while(true) { if (LEDTimer.read_ms() > timeToChangeDF){ // check for timer time out transtion - lightData = (1.0 - LightSensor.read()); // show as increasiing with increasing intensity + lightData = (1.0 - LightSensor.read()); // show as increasiing with increasing intensity sprintf(lcdData,"%4.3f",lightData); - LCDMess(lcdData); + LCDMess(lcdData); + gled = lightData; + rled = lightData; timeToChangeDF = DATATIME; LEDTimer.reset(); }