Dependencies:   PWM-Coil-driver mbed-rtos mbed

Committer:
dmwahl
Date:
Thu Jun 29 19:42:11 2017 +0000
Revision:
0:a562ecd6baab
Child:
1:08a21ae747ff
Works

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dmwahl 0:a562ecd6baab 1 #include "mbed.h"
dmwahl 0:a562ecd6baab 2 #include "rtos.h"
dmwahl 0:a562ecd6baab 3 #include "coil-driver.h"
dmwahl 0:a562ecd6baab 4 // Coil parameters [control pin, spike time (us), hold time period (us), hold time pulse width (us)]
dmwahl 0:a562ecd6baab 5 Coil yellow(A0, 200, 40, 3); // Injector
dmwahl 0:a562ecd6baab 6
dmwahl 0:a562ecd6baab 7 Coil orange(A1, 500, 40, 6); // Shutoff valve
dmwahl 0:a562ecd6baab 8 DigitalOut fb(A2); // Fast shutoff circuit for shutoff valve. High when valve is off, low when valve is on.
dmwahl 0:a562ecd6baab 9
dmwahl 0:a562ecd6baab 10 int main()
dmwahl 0:a562ecd6baab 11 {
dmwahl 0:a562ecd6baab 12 while (true) {
dmwahl 0:a562ecd6baab 13 orange.on();
dmwahl 0:a562ecd6baab 14 fb = 0;
dmwahl 0:a562ecd6baab 15 yellow.on();
dmwahl 0:a562ecd6baab 16 Thread::wait(500);
dmwahl 0:a562ecd6baab 17 orange.off();
dmwahl 0:a562ecd6baab 18 yellow.off();
dmwahl 0:a562ecd6baab 19 fb = 1;
dmwahl 0:a562ecd6baab 20 Thread::wait(500);
dmwahl 0:a562ecd6baab 21 }
dmwahl 0:a562ecd6baab 22 }