dd
Dependencies: BufferedSerial FastAnalogIn FastPWM mbed SHT75
peltiert.cpp
00001 /* 00002 * peltiert.cpp 00003 * 00004 * Created on: 2016. 2. 19. 00005 * Author: sbh9428 00006 */ 00007 00008 #include "peltiert.h" 00009 00010 peltier_t::peltier_t() { 00011 // TODO Auto-generated constructor stub 00012 00013 } 00014 00015 peltier_t::peltier_t(FastPWM* _peltier_pin, DigitalOut* _direction_pin) { 00016 peltier_pin=_peltier_pin; 00017 direction_pin=_direction_pin; 00018 00019 peltier_pin->period_ms(1); 00020 } 00021 00022 peltier_t::~peltier_t() { 00023 // TODO Auto-generated destructor stub 00024 } 00025 00026 void peltier_t::set_PWM(float duty_ratio) 00027 { 00028 if(duty_ratio>0) 00029 *direction_pin=0; 00030 else 00031 *direction_pin=1; 00032 peltier_pin->pulsewidth_us(1000*abs(duty_ratio)); 00033 }
Generated on Tue Jul 12 2022 21:44:12 by 1.7.2