Standard timer for air dryer.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
koosvanderwat
Date:
Fri Nov 29 10:17:21 2019 +0000
Parent:
2:ad0b044d0a10
Commit message:
No changes.

Changed in this revision

TextLCD.lib Show diff for this revision Revisions of this file
Watchdog1.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/TextLCD.lib	Sat Dec 04 11:31:07 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Watchdog1.lib	Fri Nov 29 10:17:21 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/koosvanderwat/code/Watchdog1/#0781d89407a5
--- a/main.cpp	Sat Dec 04 11:31:07 2010 +0000
+++ b/main.cpp	Fri Nov 29 10:17:21 2019 +0000
@@ -1,10 +1,126 @@
-// Hello World! for the TextLCD
+/* Program for Standard Timer */
+#include "mbed.h"
+#include "Watchdog1.h"
+
+// Host PC Communication channels
+//Serial pc(SERIAL_TX, SERIAL_RX); // tx, rx
+Serial pc(USBTX, USBRX);
+
+int PT = 120; // Purge time in seconds
+int RT = 60; // Repressurisation time in seconds
+int USBC = 0; // USB Communication
+
+Watchdog wd;
+
+Ticker              timeKeeping;
+
+DigitalOut my_RHMV(A2); //RHMV
+DigitalOut my_RV(A1); //RV
+DigitalOut my_RHPV(A0); //RHPV
+DigitalOut my_LHPV(A3); //LHPV
+DigitalOut my_led(LED1);  //ONLED
 
-#include "mbed.h"
-#include "TextLCD.h"
+DigitalOut my_RHPVLED(D6); //RHPVLED
+DigitalOut my_RHMVLED(D5); //RHMVLED
+DigitalOut my_RVLED(D4); //RVLED
+DigitalOut my_LHMVLED(D3); //RHMVLED
+DigitalOut my_LHPVLED(D2); //LHPVLED
+
+int secondscounter = 0;
+
+int LHCT = PT + RT; // LH cycle time
+int LHPT = PT + RT + PT; // LH purge time
+int CT = PT + RT + PT + RT; // Cycle Time
+
+int main()
+{
+    my_RHMV = 0;
+    my_RHPV = 1;
+    my_LHPV = 0;
+    my_RV = 0;
+
+    wd.Configure(4.0);
+
+    pc.printf("Dryer Start\r\n");
+
+    while(1) {
+
+        wd.Service();
+        my_led = !my_led;
+        secondscounter = secondscounter + 1;
+        wait(1);
+
+        if (USBC == 1) {
 
-TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
+            if (secondscounter <= PT) {
+                pc.printf("RH DRYING LH REGEN\r\n");
+            }
+            if (secondscounter > PT && secondscounter <= LHCT) {
+                pc.printf("RH DRYING LH REPRESS\r\n");
+            }
+            if ((secondscounter > LHCT) && (secondscounter <= LHPT)) {
+                pc.printf("LH DRYING RH REGEN\r\n");
+            }
+            if (secondscounter > LHPT && (secondscounter <= CT)) {
+                pc.printf("LH DRYING RH REPRESS\r\n");
+            }
+        } // (USB == 1)
+
+        if (secondscounter <= PT) {
+
+            my_RHMV = 0;
+            my_RHPV = 1;
+            my_LHPV = 0;
+            my_RV = 0;
+
+            my_RHPVLED = 1;  //RHPVLED
+            my_RHMVLED = 0;  //RHMVLED
+            my_RVLED = 0;  //RVLED
+            my_LHMVLED = 1;  //LHMVLED
+            my_LHPVLED = 0;  //LHPVLED
+        }
+        if (secondscounter > PT && secondscounter <= LHCT) {
+            my_RHMV = 0;
+            my_RHPV = 0;
+            my_LHPV = 0;
+            my_RV = 1;
 
-int main() {
-    lcd.printf("Hello World!\n");
-}
+            my_RHPVLED = 0;  //RHPVLED
+            my_RHMVLED = 0;  //RHMVLED
+            my_RVLED = 1;  //RVLED
+            my_LHMVLED = 1;  //LHMVLED
+            my_LHPVLED = 0;  //LHPVLED
+        }
+
+        if ((secondscounter > LHCT) && (secondscounter <= LHPT)) {
+
+            my_RHMV = 1;
+            my_RHPV = 0;
+            my_LHPV = 1;
+            my_RV = 0;
+
+            my_RHPVLED = 0;  //RHPVLED
+            my_RHMVLED = 1;  //RHMVLED
+            my_RVLED = 0;  //RVLED
+            my_LHMVLED = 0;  //LHMVLED
+            my_LHPVLED = 1;  //LHPVLED
+        }
+
+        if (secondscounter > LHPT && (secondscounter <= CT)) {
+            my_RHMV = 1;
+            my_RHPV = 0;
+            my_LHPV = 0;
+            my_RV = 1;
+
+            my_RHPVLED = 0;  //RHPVLED
+            my_RHMVLED = 1;  //RHMVLED
+            my_RVLED = 1;  //RVLED
+            my_LHMVLED = 0;  //LHMVLED
+            my_LHPVLED = 0;  //LHPVLED
+        }
+
+        if (secondscounter == (CT)) {
+            secondscounter = 0;
+        }
+    }//While
+}//main()
\ No newline at end of file
--- a/mbed.bld	Sat Dec 04 11:31:07 2010 +0000
+++ b/mbed.bld	Fri Nov 29 10:17:21 2019 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+https://os.mbed.com/users/mbed_official/code/mbed/builds/5571c4ff569f
\ No newline at end of file