Dependencies:   PWM-Coil-driver mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
iwolf32
Date:
Wed Sep 06 21:37:21 2017 +0000
Parent:
0:a562ecd6baab
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 29 19:42:11 2017 +0000
+++ b/main.cpp	Wed Sep 06 21:37:21 2017 +0000
@@ -1,22 +1,40 @@
 #include "mbed.h"
 #include "rtos.h"
 #include "coil-driver.h"
+
 // Coil parameters [control pin, spike time (us), hold time period (us), hold time pulse width (us)]
-Coil yellow(A0, 200, 40, 3); // Injector
+Coil yellow(A0, 300, 40, 4); // Injector
 
-Coil orange(A1, 500, 40, 6); // Shutoff valve
+Coil orange(A1, 2000, 40, 12); // Shutoff valve
 DigitalOut fb(A2); // Fast shutoff circuit for shutoff valve. High when valve is off, low when valve is on.
 
+InterruptIn injectorValveStatus(D7);
+InterruptIn shutoffValveStatus (D8);
+
+void injectorValveOn()
+{
+    yellow.on();
+}
+void injectorValveOff()
+{
+    yellow.off();
+}
+void shutoffValveOn()
+{
+    fb=0;
+    orange.on();
+}
+void shutoffValveOff()
+{
+    orange.off();
+    fb=1;
+}
 int main()
 {
-    while (true) {
-        orange.on();
-        fb = 0;
-        yellow.on();
-        Thread::wait(500);
-        orange.off();
-        yellow.off();
-        fb = 1;
-        Thread::wait(500);
-    }
+    while(1)  {
+    shutoffValveOff();
+    wait(1);
+    shutoffValveOn();
+    wait(1);    
+        }
 }