electrovanne declaré, je pense ca marche

This commit is contained in:
Victor Le Roch 2020-05-20 11:05:57 +02:00
parent 9527f1004b
commit f99ea9a83d
2 changed files with 55 additions and 1 deletions

View file

@ -3,3 +3,41 @@
//
#include "../../../include/DigitalDevices/DigitalActuators/DigitalActuatorElectrovanne.h"
#include "../../../include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h"
DigitalActuatorElectrovanne::DigitalActuatorElectrovanne(int temps, float thresholdHigh, float thresholdLow) : DigitalActuator(temps),
thresholdHigh(thresholdHigh), thresholdLow(thresholdLow) {}
void DigitalActuatorElectrovanne::activate() {
DigitalDevice::state = HIGH;
}
void DigitalActuatorElectrovanne::run() {
int previousState = LOW;
while (1){
state = *ptrmem;
if ((state != previousState)&&(state == HIGH)){
AnalogSensorManometre::setAlea(1);
previousState = HIGH;
} else if((state != previousState)&&(state == LOW)) {
AnalogSensorManometre::setAlea(-1);
previousState = LOW;
}
}
}
float DigitalActuatorElectrovanne::getThresholdLow() const {
return thresholdLow;
}
void DigitalActuatorElectrovanne::setThresholdLow(float thresholdLow) {
DigitalActuatorElectrovanne::thresholdLow = thresholdLow;
}
float DigitalActuatorElectrovanne::getThresholdHigh() const {
return thresholdHigh;
}
void DigitalActuatorElectrovanne::setThresholdHigh(float threshold) {
DigitalActuatorElectrovanne::thresholdHigh = threshold;
}

View file

@ -6,8 +6,24 @@
#define PROJET_VICTORAVECUNK_DIGITALACTUATORELECTROVANNE_H
class DigitalActuatorElectrovanne {
#include "../DigitalDevice.h"
class DigitalActuatorElectrovanne : public DigitalActuator{
private:
float thresholdHigh, thresholdLow;
public:
DigitalActuatorElectrovanne(int temps, float threshold, float thresholdLow);
float getThresholdHigh() const;
void setThresholdHigh(float threshold);
float getThresholdLow() const;
void setThresholdLow(float thresholdLow);
void activate();
void run();
};