HW_5.2

Dependencies:   SLCD mbed

Fork of lightsense_kl46z_basic by Stanley Cohen

Files at this revision

API Documentation at this revision

Comitter:
sbart
Date:
Mon Sep 19 06:01:15 2016 +0000
Parent:
9:f619cdaa7a65
Commit message:
Sbart_SSD341_HW_5.2_Pt1

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: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();
         }