![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Final code for paint dispensing Machine
main.cpp
- Committer:
- vmg
- Date:
- 2020-07-31
- Revision:
- 0:f58752ef18dd
File content as of revision 0:f58752ef18dd:
// Pot1 controls the paint pump which controls the panit flow rate // Pot2 controls the speed of stepper motor of the axis #include "C12832.h" #include "mbed.h" C12832 lcd(p5,p7,p6,p8,p11); PwmOut led1(LED1); AnalogIn pot1(p19); PwmOut led4(LED4); AnalogIn pot2(p20); BusIn joy(p16,p13); DigitalIn fire(p14); BusOut leds(LED2,LED3); int main() { while(1) { if (fire) { leds=0xf; } else { leds=joy; } lcd.locate(0,0); //keeps the output to lcd display in the same position each print lcd.printf("Pot 1 Paint flow rate %.2f",pot1.read()); //shows setting for pot1 - paint flow rate and sends message to lcd screen lcd.printf(" Pot 2 Axis Speed %.2f",pot2.read()); //shows setting for pot2 - axis speed - and sends message to lcd screen led1 = pot1; //led1 is the output and controlled by pot1 and represents the Paint flow rate led4 = pot2; //led2 is the output controlled by pot2 and represents the axis speed wait(0.01); // the instruction to wait 0.01 of a second } }