![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Demonstrates the use of two pumps using Hbridge
Revision 0:296f37bd5ce3, committed 2017-05-01
- Comitter:
- djrox316
- Date:
- Mon May 01 00:30:40 2017 +0000
- Commit message:
- Drink
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Mon May 01 00:30:40 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/simon/code/Motor/#f265e441bcd9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 01 00:30:40 2017 +0000 @@ -0,0 +1,24 @@ +// Demonstrates the use of two pumps using Hbridge, utilizes the forward and +// reverse functionality to dispense one drink or the other. This code +// starts one pump for 3 seconds then turns it off then starts the second +// pump for 3 seconds and turns it off. Then both pumps remain off for 3 seconds +// then the system repeats the process. + +#include "mbed.h" +#include "Motor.h" +DigitalIn stby(p25); +Motor pump(p26, p13, p14); // pwm, fwd, rev (H-bridge) + + +int main() { + stby.mode(PullUp); + while(1){ + pump.speed(1); // Drink 1 dispenses + wait(3); + pump.speed(-1); // Drink 2 dispenses + wait(3); + pump.speed(0); // pumps are stopped + wait(3); + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 01 00:30:40 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10 \ No newline at end of file