111

Dependencies:   BufferedSerial FastPWM mbed

Committer:
sbh9428
Date:
Tue Apr 12 06:52:10 2016 +0000
Revision:
0:f3108add3d98
11

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sbh9428 0:f3108add3d98 1 #include "mbed.h"
sbh9428 0:f3108add3d98 2 #include "humsensort.h"
sbh9428 0:f3108add3d98 3 #include "FastPWM.h"
sbh9428 0:f3108add3d98 4 #include "controlt.h"
sbh9428 0:f3108add3d98 5 #include "commandt.h"
sbh9428 0:f3108add3d98 6 #include "pumpt.h"
sbh9428 0:f3108add3d98 7
sbh9428 0:f3108add3d98 8 BufferedSerial pc(USBTX, USBRX, 2048);
sbh9428 0:f3108add3d98 9
sbh9428 0:f3108add3d98 10 AnalogIn humidityPin(p20);
sbh9428 0:f3108add3d98 11
sbh9428 0:f3108add3d98 12 humSensor_t humSensor(&humidityPin);
sbh9428 0:f3108add3d98 13
sbh9428 0:f3108add3d98 14 FastPWM wetPin(p21);
sbh9428 0:f3108add3d98 15 FastPWM dryPin(p22);
sbh9428 0:f3108add3d98 16
sbh9428 0:f3108add3d98 17 pump_t wetPump(&wetPin);
sbh9428 0:f3108add3d98 18 pump_t dryPump(&dryPin);
sbh9428 0:f3108add3d98 19
sbh9428 0:f3108add3d98 20 Ticker sysTick;
sbh9428 0:f3108add3d98 21
sbh9428 0:f3108add3d98 22 control_t control(&dryPump, &wetPump, &humSensor, &pc);
sbh9428 0:f3108add3d98 23
sbh9428 0:f3108add3d98 24 command_t command(&pc, &control);
sbh9428 0:f3108add3d98 25
sbh9428 0:f3108add3d98 26 void refreshPWM();
sbh9428 0:f3108add3d98 27
sbh9428 0:f3108add3d98 28 int main()
sbh9428 0:f3108add3d98 29 {
sbh9428 0:f3108add3d98 30 sysTick.attach(&refreshPWM, 5);
sbh9428 0:f3108add3d98 31 while(1)
sbh9428 0:f3108add3d98 32 {
sbh9428 0:f3108add3d98 33
sbh9428 0:f3108add3d98 34 while(pc.readable())
sbh9428 0:f3108add3d98 35 {
sbh9428 0:f3108add3d98 36 command.get_data();
sbh9428 0:f3108add3d98 37
sbh9428 0:f3108add3d98 38 }
sbh9428 0:f3108add3d98 39 }
sbh9428 0:f3108add3d98 40 }
sbh9428 0:f3108add3d98 41
sbh9428 0:f3108add3d98 42 void refreshPWM()
sbh9428 0:f3108add3d98 43 {
sbh9428 0:f3108add3d98 44 control.refreshPWM();
sbh9428 0:f3108add3d98 45 }