111

Dependencies:   BufferedSerial FastPWM mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "humsensort.h"
00003 #include "FastPWM.h"
00004 #include "controlt.h"
00005 #include "commandt.h"
00006 #include "pumpt.h"
00007 
00008 BufferedSerial pc(USBTX, USBRX, 2048);
00009 
00010 AnalogIn humidityPin(p20);
00011 
00012 humSensor_t humSensor(&humidityPin);
00013 
00014 FastPWM wetPin(p21);
00015 FastPWM dryPin(p22);
00016 
00017 pump_t wetPump(&wetPin);
00018 pump_t dryPump(&dryPin);
00019 
00020 Ticker sysTick;
00021 
00022 control_t control(&dryPump, &wetPump, &humSensor, &pc);
00023 
00024 command_t command(&pc, &control);
00025 
00026 void refreshPWM();
00027 
00028 int main()
00029 {
00030     sysTick.attach(&refreshPWM, 5); 
00031     while(1)
00032     {
00033  
00034         while(pc.readable())
00035         {
00036             command.get_data();
00037 
00038         }
00039     }
00040 }
00041 
00042 void refreshPWM()
00043 {
00044     control.refreshPWM();   
00045 }