ES_SD541_HW52a

Dependencies:   SLCD mbed

Fork of lightsense_kl46z_basic by Stanley Cohen

Revision:
10:cccc6a1739be
Parent:
9:f619cdaa7a65
--- a/main.cpp	Fri Sep 09 19:41:10 2016 +0000
+++ b/main.cpp	Mon Sep 19 12:18:34 2016 +0000
@@ -13,30 +13,35 @@
 Serial pc(USBTX, USBRX);
 Timer LEDTimer;
 
-void LCDMess(char *lMess){
-        slcd.Home();
-        slcd.clear();
-        slcd.printf(lMess);
-} 
+void LCDMess(char *lMess)
+{
+    slcd.Home();
+    slcd.clear();
+    slcd.printf(lMess);
+}
 
-
-int main() {
+int main()
+{
     AnalogIn LightSensor(LIGHTSENSORPORT);
-    float lightData; 
+    float lightData;
     char lcdData[LCDLEN];
-   
+
     int timeToChangeDF = DATATIME;
     LEDTimer.start();
     LEDTimer.reset();
     pc.printf(PROGNAME);
-    
-    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);  
+    PwmOut gled(LED_GREEN);
+    PwmOut rled(LED_RED);
+
+    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);
+            gled = lightData;
+            rled = lightData;
             timeToChangeDF = DATATIME;
             LEDTimer.reset();
-        }        
+        }
     }// emd while
 }