Projet_VictorAvecUnK/OtherDevices/DigitalDevices/DigitalActuators/DigitalActuatorRadiator.cpp

42 lines
1.2 KiB
C++

//
// Created by camer on 16/05/2020.
//
#include "../../../include/DigitalDevices/DigitalActuators/DigitalActuatorRadiator.h"
DigitalActuatorRadiator::DigitalActuatorRadiator(int temps, float thresholdHigh, float thresholdLow) : DigitalActuator(temps),
thresholdHigh(thresholdHigh), thresholdLow(thresholdLow) {}
void DigitalActuatorRadiator::activate() {
DigitalDevice::state = HIGH;
}
void DigitalActuatorRadiator::run() {
int previousState = LOW;
while (1){
state = *ptrmem;
if ((state != previousState)&&(state == HIGH)){
AnalogSensorTemperature::setAlea(1);
previousState = HIGH;
} else if((state != previousState)&&(state == LOW)) {
AnalogSensorTemperature::setAlea(-1);
previousState = LOW;
}
}
}
float DigitalActuatorRadiator::getThresholdLow() const {
return thresholdLow;
}
void DigitalActuatorRadiator::setThresholdLow(float thresholdLow) {
DigitalActuatorRadiator::thresholdLow = thresholdLow;
}
float DigitalActuatorRadiator::getThresholdHigh() const {
return thresholdHigh;
}
void DigitalActuatorRadiator::setThresholdHigh(float threshold) {
DigitalActuatorRadiator::thresholdHigh = threshold;
}