merge phmetre
This commit is contained in:
commit
af979b48bc
5 changed files with 29 additions and 9 deletions
|
@ -5,13 +5,13 @@
|
||||||
#include "../../../include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h"
|
#include "../../../include/AnalogDevices/AnalogSensors/AnalogSensorManometre.h"
|
||||||
|
|
||||||
AnalogSensorManometre::AnalogSensorManometre(float val, int temps):AnalogSensor(val,temps){ alea = 1;}
|
AnalogSensorManometre::AnalogSensorManometre(float val, int temps):AnalogSensor(val,temps){ alea = 1;}
|
||||||
|
|
||||||
void AnalogSensorManometre::run(){
|
void AnalogSensorManometre::run(){
|
||||||
int cpt = 0;
|
int cpt = 0;
|
||||||
while(1){
|
while(1){
|
||||||
if(ptrmem!=NULL){
|
if(ptrmem!=NULL){
|
||||||
if(cpt == 5){
|
if(cpt == 5){
|
||||||
*ptrmem = val - alea;
|
*ptrmem = val - alea;
|
||||||
|
val = val - alea;
|
||||||
cpt = 0;
|
cpt = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,18 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "../../../include/AnalogDevices/AnalogSensors/AnalogSensorPHmetre.h"
|
#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 ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#define MAX_I2C_DEVICES 4
|
#define MAX_I2C_DEVICES 4
|
||||||
#define I2C_BUFFER_SIZE 1024
|
#define I2C_BUFFER_SIZE 1024
|
||||||
#define MAX_IO_PIN 6
|
#define MAX_IO_PIN 6
|
||||||
#define THRESHOLDHIGH 17
|
#define THRESHOLDHIGH 25
|
||||||
#define THRESHOLDLOW 15
|
#define THRESHOLDLOW 20
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
#ifndef PROJET_VICTORAVECUNK_ANALOGSENSORMANOMETRE_H
|
#ifndef PROJET_VICTORAVECUNK_ANALOGSENSORMANOMETRE_H
|
||||||
#define PROJET_VICTORAVECUNK_ANALOGSENSORMANOMETRE_H
|
#define PROJET_VICTORAVECUNK_ANALOGSENSORMANOMETRE_H
|
||||||
#include <iostream>
|
//#include <iostream>
|
||||||
#include <thread>
|
//#include <thread>
|
||||||
#include <unistd.h>
|
//#include <unistd.h>
|
||||||
#include <string.h>
|
//#include <string.h>
|
||||||
#include <fstream>
|
//#include <fstream>
|
||||||
#include "../AnalogDevice.h"
|
#include "../AnalogDevice.h"
|
||||||
|
|
||||||
class AnalogSensorManometre : public AnalogSensor{
|
class AnalogSensorManometre : public AnalogSensor{
|
||||||
|
|
|
@ -5,9 +5,14 @@
|
||||||
#ifndef PROJET_VICTORAVECUNK_ANALOGSENSORPHMETRE_H
|
#ifndef PROJET_VICTORAVECUNK_ANALOGSENSORPHMETRE_H
|
||||||
#define 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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue