Compare commits
4 commits
b680750540
...
26c01c1dbe
Author | SHA1 | Date | |
---|---|---|---|
26c01c1dbe | |||
984dddb88b | |||
5bfd6e3687 | |||
b01f407157 |
3 changed files with 43 additions and 4 deletions
|
@ -3,3 +3,30 @@
|
|||
//
|
||||
|
||||
#include "../../../include/DigitalDevices/DigitalActuators/DigitalActuatorRadiator.h"
|
||||
|
||||
DigitalActuatorRadiator::DigitalActuatorRadiator(int temps, float threshold) : DigitalActuator(temps),
|
||||
threshold(threshold) {}
|
||||
|
||||
void DigitalActuatorRadiator::activate() {
|
||||
DigitalDevice::state = HIGH;
|
||||
}
|
||||
|
||||
void DigitalActuatorRadiator::Run() {
|
||||
int previousState = LOW;
|
||||
while (1){
|
||||
state = *ptrmem;
|
||||
if ((state != previousState)||(state == HIGH)){
|
||||
AnalogSensorTemperature::setAlea(1);
|
||||
} else if((state != previousState)||(state == LOW)) {
|
||||
AnalogSensorTemperature::setAlea(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float DigitalActuatorRadiator::getThreshold() const {
|
||||
return threshold;
|
||||
}
|
||||
|
||||
void DigitalActuatorRadiator::setThreshold(float threshold) {
|
||||
DigitalActuatorRadiator::threshold = threshold;
|
||||
}
|
||||
|
|
|
@ -12,15 +12,16 @@
|
|||
#include <fstream>
|
||||
#include "../AnalogDevice.h"
|
||||
|
||||
|
||||
// exemple de capteur analogique de temperature, ne pas oublier d'heriter de Device
|
||||
class AnalogSensorTemperature: public AnalogDevice {
|
||||
private:
|
||||
// fait osciller la valeur du cpateur de 1
|
||||
int alea;
|
||||
|
||||
static int alea;
|
||||
public:
|
||||
// fait osciller la valeur du cpateur de 1
|
||||
//constructeur ne pas oublier d'initialiser la classe mere
|
||||
AnalogSensorTemperature(int d,int t);
|
||||
static void setAlea(int alea);
|
||||
// thread representant le capteur et permettant de fonctionner independamment de la board
|
||||
virtual void run();
|
||||
};
|
||||
|
|
|
@ -6,8 +6,19 @@
|
|||
#define PROJET_VICTORAVECUNK_DIGITALACTUATORRADIATOR_H
|
||||
|
||||
|
||||
class DigitalActuatorRadiator {
|
||||
#include "../DigitalDevice.h"
|
||||
#include "../../../include/AnalogDevices/AnalogSensors/AnalogSensorTemperature.h"
|
||||
|
||||
class DigitalActuatorRadiator : public DigitalActuator {
|
||||
private:
|
||||
float threshold;
|
||||
public:
|
||||
DigitalActuatorRadiator(int temps, float threshold);
|
||||
|
||||
float getThreshold() const;
|
||||
void setThreshold(float threshold);
|
||||
void activate();
|
||||
void Run();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue