Keisha Brathwaite
/
KBrat-SSD541-HW-5_2
KBrat-SSD541-HW-5_2
Fork of lightsense_kl46z_basic by
Revision 10:8ad79c335cfa, committed 2016-09-19
- Comitter:
- tisbrat
- Date:
- Mon Sep 19 06:21:08 2016 +0000
- Parent:
- 9:f619cdaa7a65
- Commit message:
- KBrat-SSD541-HW-5_2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 09 19:41:10 2016 +0000 +++ b/main.cpp Mon Sep 19 06:21:08 2016 +0000 @@ -2,7 +2,7 @@ #include "SLCD.h" -#define PROGNAME "lightsense_kl46z_basic v1\n\r" +#define PROGNAME "KBrat-SSD541-HW-5_2_Part1\n\r" #define DATATIME 400 // milliseconds #define LCDLEN 10 #define LIGHTSENSORPORT PTE22 @@ -24,6 +24,8 @@ AnalogIn LightSensor(LIGHTSENSORPORT); float lightData; char lcdData[LCDLEN]; + PwmOut gled(LED_GREEN); + PwmOut rled(LED_RED); int timeToChangeDF = DATATIME; LEDTimer.start(); @@ -32,11 +34,15 @@ while(true) { if (LEDTimer.read_ms() > timeToChangeDF){ // check for timer time out transtion - lightData = (1.0 - LightSensor.read()); // show as increasiing with increasing intensity - sprintf(lcdData,"%4.3f",lightData); - LCDMess(lcdData); + lightData = (1.0 - LightSensor.read()); // show as increasing with increasing intensity + sprintf(lcdData,"%4.3f",lightData); + LCDMess(lcdData); + gled = 1.0 - lightData; //green light changes intensity as light data changes + rled = 1.0 - lightData; //red light changes intensity as light data changes timeToChangeDF = DATATIME; LEDTimer.reset(); } - }// emd while + }// end while } + +