main avec radiator et manometre, test sans la boucle for
This commit is contained in:
parent
b23f800eff
commit
4ab22f4df3
7 changed files with 19 additions and 13 deletions
BIN
OtherDevices/DigitalDevices/.DS_Store
vendored
BIN
OtherDevices/DigitalDevices/.DS_Store
vendored
Binary file not shown.
|
@ -1,7 +1,8 @@
|
||||||
//
|
//
|
||||||
// Created by camer on 16/05/2020.
|
// Created by camer on 16/05/2020.
|
||||||
//
|
//
|
||||||
|
//#define PATH "D:\\Documents\\Etudes\\INSA\\4A\\BECpp\\Projet_VictorAvecUnK\\src\\on.txt"
|
||||||
|
#define PATH "/Users/victorleroch/Documents/INSA/Année4/C++/Projet_VictorAvecUnK/on.txt"
|
||||||
#include "../../../include/DigitalDevices/DigitalSensors/ExternalDigitalSensorButton.h"
|
#include "../../../include/DigitalDevices/DigitalSensors/ExternalDigitalSensorButton.h"
|
||||||
|
|
||||||
//ExternalDigDevice/////////////////////////
|
//ExternalDigDevice/////////////////////////
|
||||||
|
@ -14,7 +15,7 @@ int ExternalDigitalSensorButton::getState(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExternalDigitalSensorButton::setState() {
|
void ExternalDigitalSensorButton::setState() {
|
||||||
if (ifstream ("D:\\Documents\\Etudes\\INSA\\4A\\BECpp\\Projet_VictorAvecUnK\\src\\on.txt")){
|
if (ifstream (PATH)){
|
||||||
state = HIGH;
|
state = HIGH;
|
||||||
} else {
|
} else {
|
||||||
state = LOW;
|
state = LOW;
|
||||||
|
|
|
@ -18,7 +18,7 @@ int main(){
|
||||||
AnalogSensorLuminosity luminosite(DELAY);
|
AnalogSensorLuminosity luminosite(DELAY);
|
||||||
ExternalDigitalSensorButton button(DELAY);
|
ExternalDigitalSensorButton button(DELAY);
|
||||||
AnalogSensorManometre manometre(4,DELAY);
|
AnalogSensorManometre manometre(4,DELAY);
|
||||||
//DigitalActuatorRadiator radiator(
|
DigitalActuatorRadiator radiator(DELAY, THRESHOLDHIGH, THRESHOLDLOW);
|
||||||
|
|
||||||
|
|
||||||
// branchement des capteurs actionneurs
|
// branchement des capteurs actionneurs
|
||||||
|
@ -28,6 +28,7 @@ int main(){
|
||||||
esp8266.i2c(1,screen);
|
esp8266.i2c(1,screen);
|
||||||
esp8266.pin(4, button);
|
esp8266.pin(4, button);
|
||||||
esp8266.pin(5, manometre);
|
esp8266.pin(5, manometre);
|
||||||
|
esp8266.pin(6, radiator);
|
||||||
|
|
||||||
// allumage de la carte
|
// allumage de la carte
|
||||||
esp8266.run();
|
esp8266.run();
|
||||||
|
|
|
@ -13,6 +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 THRESHOLDLOW 15
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
BIN
include/.DS_Store
vendored
BIN
include/.DS_Store
vendored
Binary file not shown.
BIN
include/DigitalDevices/.DS_Store
vendored
Normal file
BIN
include/DigitalDevices/.DS_Store
vendored
Normal file
Binary file not shown.
|
@ -6,10 +6,12 @@ void Board::setup(){
|
||||||
// on configure la vitesse de la liaison
|
// on configure la vitesse de la liaison
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
// on fixe les pin en entree et en sorite en fonction des capteurs/actionneurs mis sur la carte
|
// on fixe les pin en entree et en sorite en fonction des capteurs/actionneurs mis sur la carte
|
||||||
pinMode(1,INPUT);
|
pinMode(1, INPUT);
|
||||||
pinMode(0,OUTPUT);
|
pinMode(0, OUTPUT);
|
||||||
pinMode(2,INPUT);
|
pinMode(2, INPUT);
|
||||||
pinMode(4, INPUT);
|
pinMode(4, INPUT);
|
||||||
|
pinMode(5, INPUT);
|
||||||
|
pinMode(6, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// la boucle de controle arduino
|
// la boucle de controle arduino
|
||||||
|
@ -20,8 +22,8 @@ void Board::loop(){
|
||||||
static int cpt=0;
|
static int cpt=0;
|
||||||
static int bascule=0;
|
static int bascule=0;
|
||||||
int i=0;
|
int i=0;
|
||||||
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
|
||||||
val1 = analogRead(1);
|
val1 = analogRead(1);
|
||||||
sprintf(buf, "temperature %d", val1);
|
sprintf(buf, "temperature %d", val1);
|
||||||
|
@ -31,18 +33,18 @@ void Board::loop(){
|
||||||
val = analogRead(2);
|
val = analogRead(2);
|
||||||
sprintf(buf, "luminosite %d", val);
|
sprintf(buf, "luminosite %d", val);
|
||||||
Serial.println(buf);
|
Serial.println(buf);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(cpt%5==0){
|
// if(cpt%5==0){
|
||||||
// tous les 5 fois on affiche sur l ecran la temperature
|
// tous les 5 fois on affiche sur l ecran la temperature
|
||||||
sprintf(buf,"%d",val1);
|
sprintf(buf,"%d",val1);
|
||||||
bus.write(1,buf,100);
|
bus.write(1,buf,100);
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
cpt++;
|
cpt++;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
//}
|
||||||
// on eteint et on allume la LED
|
// on eteint et on allume la LED
|
||||||
if(analogRead(4))
|
if(analogRead(4))
|
||||||
digitalWrite(0,HIGH);
|
digitalWrite(0,HIGH);
|
||||||
|
|
Loading…
Reference in a new issue