main complété avec terarium, build and run ok
This commit is contained in:
parent
1ce23256c1
commit
36360fdb88
2 changed files with 22 additions and 8 deletions
|
@ -5,7 +5,7 @@
|
|||
#include "../include/TerrariumParameter.h"
|
||||
//Constructor
|
||||
TerrariumParameter::TerrariumParameter(int thresholdHigh, int thresholdLow) : thresholdHigh(thresholdHigh),
|
||||
thresholdLow(thresholdLow) {}
|
||||
thresholdLow(thresholdLow){}
|
||||
|
||||
//Getters Setters
|
||||
float TerrariumParameter::getValue() const {
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
#include <unistd.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
|
||||
void Board::setup(){
|
||||
// on configure la vitesse de la liaison
|
||||
|
@ -13,6 +22,11 @@ void Board::setup(){
|
|||
pinMode(4, INPUT);
|
||||
pinMode(5, INPUT);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
digitalWrite(0,LOW);
|
||||
//pinMode(6, OUTPUT);
|
||||
}
|
||||
|
@ -28,17 +42,17 @@ void Board::loop(){
|
|||
//for(i=0;i<10;i++){
|
||||
// if (i%3==0) {
|
||||
// lecture sur la pin 1 : capteur de temperature
|
||||
val1 = analogRead(1);
|
||||
sprintf(buf, "temperature %d", val1);
|
||||
temperature.setValue(analogRead(1));
|
||||
sprintf(buf, "temperature %f", temperature.getValue());
|
||||
Serial.println(buf);
|
||||
|
||||
if ((val1 < THRESHOLDLOW)&&(radState == LOW)) {
|
||||
if ((temperature.is2Low()) && (terrarium.getRadState() == LOW)) {
|
||||
digitalWrite(0, HIGH);
|
||||
radState = HIGH;
|
||||
terrarium.setRadState(HIGH);
|
||||
}
|
||||
else if ((val1 > THRESHOLDHIGH)&&(radState == HIGH)) {
|
||||
else if ((temperature.is2High() ) && (terrarium.getRadState() == HIGH)) {
|
||||
digitalWrite(0, LOW);
|
||||
radState = LOW;
|
||||
terrarium.setRadState(LOW);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue