dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
Diff: peltiert.cpp
- Revision:
- 0:9bfc4aea91e2
- Child:
- 10:c751a0e8b7f9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/peltiert.cpp Fri Feb 19 07:07:26 2016 +0000 @@ -0,0 +1,33 @@ +/* + * peltiert.cpp + * + * Created on: 2016. 2. 19. + * Author: sbh9428 + */ + +#include "peltiert.h" + +peltier_t::peltier_t() { + // TODO Auto-generated constructor stub + +} + +peltier_t::peltier_t(FastPWM* _peltier_pin, DigitalOut* _direction_pin) { + peltier_pin=_peltier_pin; + direction_pin=_direction_pin; + + peltier_pin->period_ms(1); +} + +peltier_t::~peltier_t() { + // TODO Auto-generated destructor stub +} + +void peltier_t::set_PWM(float duty_ratio) +{ + if(duty_ratio>0) + *direction_pin=1; + else + *direction_pin=0; + peltier_pin->pulsewidth_us(1000*abs(duty_ratio)); +} \ No newline at end of file