The use of the KL-46Z FRDM microcontroller to handle the I/O to detect water moisture and light exposure for a potted plant using a 555 Timer Chip and onboard visible light sensor. This project is incomplete as of 4/26/15

Dependencies:   SLCD mbed

Revision:
1:5b951fe1f430
Parent:
0:1a57cdd09c38
Child:
2:435f5545e2b6
diff -r 1a57cdd09c38 -r 5b951fe1f430 main.cpp
--- a/main.cpp	Sun Apr 26 23:34:56 2015 +0000
+++ b/main.cpp	Mon May 04 21:23:28 2015 +0000
@@ -20,7 +20,7 @@
 #define DATARATE 1000 // ms time between data takes.
 #define LCDLEN 10
 
-#define MAXTIME 500
+#define MAXTIME 2
 #define TIMERSTATE 0
 #define CHECKMOISTURE 1
 #define MOREMOISTURE 2
@@ -77,16 +77,10 @@
 void setup() {
   
   // initialize serial communication:
-  
-  pc.printf(PROGNAME);
   oneShotIn.write(HIGH);
   oneShotOut.mode(PullNone);
-  ledPin.write(LOW);
   milliTimer.start();
   milliTimer.reset();
-  nextDataTake =  DATARATE;
-  lastButtonState = LOW;
-  oneShotLen = 0;
 }
 
 void readLightSensor() {
@@ -110,10 +104,11 @@
 int main(){
     setup();
     pulseOut(OUTPULSELEN);
-    LCDMess(PROGNAME);
+    //LCDMess(PROGNAME);
     milliTimer.start();
     milliTimer.reset();
     PgmState = TIMERSTATE; 
+    int count = 0;
     
     while (true) {
         switch(PgmState) {
@@ -122,7 +117,7 @@
             //Go on to CHECKMOISTURE
             if(milliTimer.read_ms() >= MAXTIME) {
                 milliTimer.reset();
-                PgmState = CHECKMOISTURE; 
+                PgmState = CHECKLIGHT; 
             }
             break;
             case CHECKMOISTURE:
@@ -150,7 +145,10 @@
                 pc.printf(LL);
                 PgmState = TIMERSTATE;
             break;
+            
         }
+        count++;
+        pc.printf("d",count);
         wait(DATATIME);
     }
 }
\ No newline at end of file