diff --git a/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorManometre.cpp b/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorManometre.cpp index 4d214a6..ee44dda 100644 --- a/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorManometre.cpp +++ b/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorManometre.cpp @@ -12,6 +12,7 @@ void AnalogSensorManometre::run(){ if(ptrmem!=NULL){ if(cpt == 5){ *ptrmem = val - alea; + val = val - alea; cpt = 0; } } diff --git a/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.cpp b/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.cpp index a8e3048..9fd9974 100644 --- a/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.cpp +++ b/OtherDevices/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.cpp @@ -3,3 +3,18 @@ // #include "../../../include/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.h" + +AnalogSensorPHmetre::AnalogSensorPHmetre(float val, int temps) : AnalogSensor(val, temps) {} +int AnalogSensorPHmetre::alea = 1; +void AnalogSensorPHmetre::run() { + int cpt = 0; + while (ptrmem!=NULL){ + if (cpt == 3){ + *ptrmem = val - alea; + val = val - alea; + cpt = 0; + } + sleep(temps); + cpt ++; + } +} diff --git a/core_simulation.h b/core_simulation.h index 092d922..c610f79 100644 --- a/core_simulation.h +++ b/core_simulation.h @@ -13,8 +13,8 @@ #define MAX_I2C_DEVICES 4 #define I2C_BUFFER_SIZE 1024 #define MAX_IO_PIN 6 -#define THRESHOLDHIGH 17 -#define THRESHOLDLOW 15 +#define THRESHOLDHIGH 25 +#define THRESHOLDLOW 20 using namespace std; diff --git a/include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h b/include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h index 08886bb..bbb2897 100644 --- a/include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h +++ b/include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h @@ -4,11 +4,11 @@ #ifndef PROJET_VICTORAVECUNK_ANALOGSENSORMANOMETRE_H #define PROJET_VICTORAVECUNK_ANALOGSENSORMANOMETRE_H -#include -#include -#include -#include -#include +//#include +//#include +//#include +//#include +//#include #include "../AnalogDevice.h" class AnalogSensorManometre : public AnalogSensor{ diff --git a/include/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.h b/include/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.h index 8b8ab84..7b819eb 100644 --- a/include/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.h +++ b/include/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.h @@ -5,9 +5,14 @@ #ifndef PROJET_VICTORAVECUNK_ANALOGSENSORPHMETRE_H #define PROJET_VICTORAVECUNK_ANALOGSENSORPHMETRE_H +#include "../AnalogDevice.h" -class AnalogSensorPHmetre { +class AnalogSensorPHmetre : public AnalogSensor { +public: + static int alea; + AnalogSensorPHmetre(float val, int temps); + virtual void run(); }; diff --git a/sketch_ino.cpp b/sketch_ino.cpp index 07afe13..126f2ad 100644 --- a/sketch_ino.cpp +++ b/sketch_ino.cpp @@ -31,7 +31,7 @@ void Board::loop(){ val1 = analogRead(1); sprintf(buf, "temperature %d", val1); Serial.println(buf); - + // Activation or not of the radiator if ((val1 < THRESHOLDLOW)&&(radState == LOW)) { digitalWrite(0, HIGH); radState = HIGH; @@ -41,10 +41,8 @@ void Board::loop(){ radState = LOW; } - - // lecture sur la pin 2 : capteur de temperature - val = analogRead(2); - sprintf(buf, "luminosite %d", val); + val1 = analogRead(5); + sprintf(buf, "pressure %d", val1); Serial.println(buf); // }