
PIDHeater82
Dependencies: PID mbed millis ttmath
Fork of PIDHeater by
Diff: PIDHeater.h
- Revision:
- 2:6e731a17523c
- Parent:
- 1:b852d582ad0e
- Child:
- 3:00a491d8ed0c
--- a/PIDHeater.h Wed Jan 27 21:32:34 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -#ifndef PID_HEATER_H -#define PID_HEATER_H - -#include "mbed.h" - -#include "PID.h" -// These values were borrowed from Marlin Firmware defaults -#define DEFAULT_Kp 17.52 -#define DEFAULT_Ki 0.62 -#define DEFAULT_Kd 123.43 - - -/** A simple class for temperature control of a heater element using PID - * a heater driven via PWM digital output and one analog temperature sensor. - * - * Author(s): Michael Ball unix_guru@hotmail.com - * - */ -class PIDHeater{ - public: - /** Constructor receives pin names of the temperature sensor and - * the DigitalOut pin to which the heater driver is connected. */ - PIDHeater(PinName sensorPin, PinName digitalOutPin); - /** Set the temperature range of the sensor. */ - void configureRange(float minTemperature, float maxTemperature); - /** Read the current room temperature from the sensor. */ - float getTemperature(); - /** Test if the heater in turned ON. */ - bool isHeaterOn(); - /** Set the desired room temperature. */ - void setTemperature(float temp); - /** Attach run process to a timer */ - void run(); - - private: - AnalogIn thermistor; - DigitalOut driver; - Ticker ticker; - bool heaterOn; - float currentTemp, desiredTemp, minTemp, maxTemp, hysteresis, pwmValue; -}; - -#endif // HEATER_H \ No newline at end of file