Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 2:435f5545e2b6, committed 2015-05-04
- Comitter:
- bomalley
- Date:
- Mon May 04 21:37:27 2015 +0000
- Parent:
- 1:5b951fe1f430
- Commit message:
- Finished timer chip fn
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon May 04 21:23:28 2015 +0000
+++ b/main.cpp Mon May 04 21:37:27 2015 +0000
@@ -28,8 +28,12 @@
#define MORELIGHT 4
#define LESSLIGHT 5
-#define LIGHTMIN .100
-#define LIGHTMAX .900
+#define LIGHTMIN .100 //there is too much light
+#define LIGHTMAX .900 // there is not enough light
+
+#define WATERMAX 1500 //Do not water. There is Moisture
+#define WATERMIN 3000 //Water, there is no moisture
+
#define ML "MORE LIGHT"
#define LL "LESS LIGHT"
#define MW "MORE WATER"
@@ -99,14 +103,27 @@
void readTimerChip() {
timerChip = oneShotOut.read();
// pc.printf();
+ /****
+ #define WATERMAX 1500 //Do not water. There is Moisture
+ #define WATERMIN 3000 //Water, there is no moisture
+ ***/
+
+ if(timerChip >= WATERMAX) {
+ //Do not water move to check light
+ PgmState = CHECKLIGHT;
+ }
+ else if(timerChip <= WATERMIN) {
+ //Tell pc to water then move to check light
+ pc.printf(MW);
+ PgmState = CHECKLIGHT;
+ }
}
int main(){
- setup();
+
pulseOut(OUTPULSELEN);
//LCDMess(PROGNAME);
- milliTimer.start();
- milliTimer.reset();
+ setup();
PgmState = TIMERSTATE;
int count = 0;
@@ -117,7 +134,7 @@
//Go on to CHECKMOISTURE
if(milliTimer.read_ms() >= MAXTIME) {
milliTimer.reset();
- PgmState = CHECKLIGHT;
+ PgmState = CHECKMOISTURE;
}
break;
case CHECKMOISTURE: