Dustin Campbell
/
drinkdispense
Demonstrates the use of two pumps using Hbridge
main.cpp
- Committer:
- djrox316
- Date:
- 2017-05-01
- Revision:
- 0:296f37bd5ce3
File content as of revision 0:296f37bd5ce3:
// 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); } }