dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
Diff: main.cpp
- Revision:
- 0:9bfc4aea91e2
- Child:
- 1:5c42ec7f1aeb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 19 07:07:26 2016 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" + +#include "BufferedSerial.h" +#include "FastAnalogIn.h" +#include "FastPWM.h" + +#include "commandt.h" +#include "controlt.h" +#include "peltiert.h" +#include "tempsensort.h" + +Ticker controltick; + +FastAnalogIn temp_sensor_pin(p20); + +temp_sensor_t temp_sensor(&temp_sensor_pin); + + + +FastPWM PWM_pin(p21); +DigitalOut PWM_dir(p22); + +peltier_t peltier(&PWM_pin, &PWM_dir); + + + +control_t control(&temp_sensor, &peltier); + + + + +BufferedSerial pc(USBTX, USBRX); + + + +command_t command(&pc, &control); + + + +void peltier_control(); + +int main() { + pc.printf("temperature start \n"); + + controltick.attach(&peltier_control, 1); + + + + while(1) + { + while(pc.readable()) + { + command.get_data(); + } + } + +} + +void peltier_control() +{ + command.refreshPWM(); +} \ No newline at end of file