a simplistic controller to run a pump

Dependencies:   mbed

Committer:
sandwich
Date:
Sat Dec 14 23:54:59 2013 +0000
Revision:
0:4f21cc600d24
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sandwich 0:4f21cc600d24 1 #include "mbed.h"
sandwich 0:4f21cc600d24 2
sandwich 0:4f21cc600d24 3 DigitalOut outA(p21), outB(p22);
sandwich 0:4f21cc600d24 4 PwmOut pwm(p23);
sandwich 0:4f21cc600d24 5
sandwich 0:4f21cc600d24 6 int main(void)
sandwich 0:4f21cc600d24 7 {
sandwich 0:4f21cc600d24 8 outA=0;
sandwich 0:4f21cc600d24 9 outB=1;
sandwich 0:4f21cc600d24 10 float out=0;
sandwich 0:4f21cc600d24 11 while (1) {
sandwich 0:4f21cc600d24 12 pwm.write(out);
sandwich 0:4f21cc600d24 13 out+=0.1f;
sandwich 0:4f21cc600d24 14 if (out>=1.0f) {
sandwich 0:4f21cc600d24 15 out=0;
sandwich 0:4f21cc600d24 16 }
sandwich 0:4f21cc600d24 17 wait(0.5);
sandwich 0:4f21cc600d24 18 }
sandwich 0:4f21cc600d24 19 return 0;
sandwich 0:4f21cc600d24 20 }