İşlemeleri karşılaştır
Ortak bir işleme yok. "6aa5733c3dfe4fb45774ba0ff4a1bd4603263e7d" ve "e5593747cf30e88792947fb1c74c4efc69cf3539" tamamen farklı geçmişlere sahip.
6aa5733c3d
...
e5593747cf
12 değiştirilmiş dosya ile 16 ekleme ve 227 silme
|
|
@ -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,18 +3,3 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#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 ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Victor Le Roch on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef BE_TERRARIUM_H
|
|
||||||
#define BE_TERRARIUM_H
|
|
||||||
|
|
||||||
|
|
||||||
class Terrarium {
|
|
||||||
private:
|
|
||||||
int id;
|
|
||||||
int radState;
|
|
||||||
int tapState;
|
|
||||||
public:
|
|
||||||
Terrarium(int id);
|
|
||||||
|
|
||||||
int getRadState() const;
|
|
||||||
void setRadState(int radState);
|
|
||||||
int getTapState() const;
|
|
||||||
void setTapState(int tadState);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //BE_TERRARIUM_H
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
//
|
|
||||||
// Created by camer on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef PROJET_VICTORAVECUNK_TERRARIUMPARAMETER_H
|
|
||||||
#define PROJET_VICTORAVECUNK_TERRARIUMPARAMETER_H
|
|
||||||
|
|
||||||
|
|
||||||
class TerrariumParameter { //TODO add to diagram
|
|
||||||
private:
|
|
||||||
float value;
|
|
||||||
int thresholdHigh;
|
|
||||||
int thresholdLow;
|
|
||||||
public:
|
|
||||||
TerrariumParameter(int thresholdHigh, int thresholdLow);
|
|
||||||
|
|
||||||
//getters setters
|
|
||||||
float getValue() const;
|
|
||||||
void setValue(float value);
|
|
||||||
int getThresholdHigh() const;
|
|
||||||
void setThresholdHigh(int thresholdHigh);
|
|
||||||
int getThresholdLow() const;
|
|
||||||
void setThresholdLow(int thresholdLow);
|
|
||||||
|
|
||||||
bool is2High();
|
|
||||||
bool is2Low();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //PROJET_VICTORAVECUNK_TERRARIUMPARAMETER_H
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Victor Le Roch on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef BE_TORTUE_H
|
|
||||||
#define BE_TORTUE_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class Tortue{
|
|
||||||
private:
|
|
||||||
std::string nom;
|
|
||||||
int naissance;
|
|
||||||
std::string sexe;
|
|
||||||
public:
|
|
||||||
Tortue(const std::string &nom, const std::string &sexe);
|
|
||||||
|
|
||||||
const std::string &getNom() const;
|
|
||||||
|
|
||||||
int getNaissance() const;
|
|
||||||
int getAge() const;
|
|
||||||
|
|
||||||
const std::string &getSexe() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //BE_TORTUE_H
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Victor Le Roch on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "../include/Terrarium.h"
|
|
||||||
#include "../../core_simulation.h"
|
|
||||||
Terrarium::Terrarium(int id) : id(id),
|
|
||||||
radState(LOW), tapState(LOW){}
|
|
||||||
|
|
||||||
int Terrarium::getRadState() const {
|
|
||||||
return radState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Terrarium::setRadState(int radState) {
|
|
||||||
Terrarium::radState = radState;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Terrarium::getTapState() const {
|
|
||||||
return tapState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Terrarium::setTapState(int tapState) {
|
|
||||||
Terrarium::tapState = tapState;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
//
|
|
||||||
// Created by camer on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "../include/TerrariumParameter.h"
|
|
||||||
//Constructor
|
|
||||||
TerrariumParameter::TerrariumParameter(int thresholdHigh, int thresholdLow) : thresholdHigh(thresholdHigh),
|
|
||||||
thresholdLow(thresholdLow){}
|
|
||||||
|
|
||||||
//Getters Setters
|
|
||||||
float TerrariumParameter::getValue() const {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
void TerrariumParameter::setValue(float value) {
|
|
||||||
TerrariumParameter::value = value;
|
|
||||||
}
|
|
||||||
int TerrariumParameter::getThresholdHigh() const {
|
|
||||||
return thresholdHigh;
|
|
||||||
}
|
|
||||||
void TerrariumParameter::setThresholdHigh(int thresholdHigh) {
|
|
||||||
TerrariumParameter::thresholdHigh = thresholdHigh;
|
|
||||||
}
|
|
||||||
int TerrariumParameter::getThresholdLow() const {
|
|
||||||
return thresholdLow;
|
|
||||||
}
|
|
||||||
void TerrariumParameter::setThresholdLow(int thresholdLow) {
|
|
||||||
TerrariumParameter::thresholdLow = thresholdLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Methods
|
|
||||||
bool TerrariumParameter::is2High() {
|
|
||||||
return this->value > this->thresholdHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TerrariumParameter::is2Low() {
|
|
||||||
return this->value < this->thresholdLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Victor Le Roch on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "../include/Tortue.h"
|
|
||||||
#include "../../core_simulation.h"
|
|
||||||
//#include <string>
|
|
||||||
|
|
||||||
const std::string &Tortue::getNom() const {
|
|
||||||
return nom;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Tortue::getNaissance() const {
|
|
||||||
return naissance;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string &Tortue::getSexe() const {
|
|
||||||
return sexe;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tortue::Tortue(const string &nom, const string &sexe) : nom(nom), sexe(sexe) {
|
|
||||||
naissance = std::time(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Tortue::getAge() const {
|
|
||||||
int ageSec = std::time(nullptr) - naissance;
|
|
||||||
int ageHour = ageSec/(60*60);
|
|
||||||
int ageDay = ageHour/24;
|
|
||||||
int age = ageDay / 365.25;
|
|
||||||
return age;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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 25
|
#define THRESHOLDHIGH 17
|
||||||
#define THRESHOLDLOW 20
|
#define THRESHOLDLOW 15
|
||||||
|
|
||||||
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,14 +5,9 @@
|
||||||
#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 : public AnalogSensor {
|
class AnalogSensorPHmetre {
|
||||||
public:
|
|
||||||
static int alea;
|
|
||||||
|
|
||||||
AnalogSensorPHmetre(float val, int temps);
|
|
||||||
virtual void run();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "core_simulation.h"
|
#include "core_simulation.h"
|
||||||
#include "app/include/Terrarium.h"
|
|
||||||
#include "app/include/TerrariumParameter.h"
|
|
||||||
|
|
||||||
|
|
||||||
Terrarium terrarium(1);
|
|
||||||
TerrariumParameter temperature(25, 20);
|
|
||||||
TerrariumParameter pressure(3000,2990);
|
|
||||||
TerrariumParameter ph(8,6);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int radState = LOW;
|
||||||
// la fonction d'initialisation d'arduino
|
// la fonction d'initialisation d'arduino
|
||||||
void Board::setup(){
|
void Board::setup(){
|
||||||
// on configure la vitesse de la liaison
|
// on configure la vitesse de la liaison
|
||||||
|
|
@ -22,11 +13,6 @@ void Board::setup(){
|
||||||
pinMode(4, INPUT);
|
pinMode(4, INPUT);
|
||||||
pinMode(5, INPUT);
|
pinMode(5, INPUT);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
digitalWrite(0,LOW);
|
digitalWrite(0,LOW);
|
||||||
//pinMode(6, OUTPUT);
|
//pinMode(6, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
@ -42,17 +28,17 @@ void Board::loop(){
|
||||||
//for(i=0;i<10;i++){
|
//for(i=0;i<10;i++){
|
||||||
// if (i%3==0) {
|
// if (i%3==0) {
|
||||||
// lecture sur la pin 1 : capteur de temperature
|
// lecture sur la pin 1 : capteur de temperature
|
||||||
temperature.setValue(analogRead(1));
|
val1 = analogRead(1);
|
||||||
sprintf(buf, "temperature %f", temperature.getValue());
|
sprintf(buf, "temperature %d", val1);
|
||||||
Serial.println(buf);
|
Serial.println(buf);
|
||||||
|
|
||||||
if ((temperature.is2Low()) && (terrarium.getRadState() == LOW)) {
|
if ((val1 < THRESHOLDLOW)&&(radState == LOW)) {
|
||||||
digitalWrite(0, HIGH);
|
digitalWrite(0, HIGH);
|
||||||
terrarium.setRadState(HIGH);
|
radState = HIGH;
|
||||||
}
|
}
|
||||||
else if ((temperature.is2High() ) && (terrarium.getRadState() == HIGH)) {
|
else if ((val1 > THRESHOLDHIGH)&&(radState == HIGH)) {
|
||||||
digitalWrite(0, LOW);
|
digitalWrite(0, LOW);
|
||||||
terrarium.setRadState(LOW);
|
radState = LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Yükleniyor…
Yeni konuda referans