diff --git a/OtherDevices/DigitalDevices/.DS_Store b/OtherDevices/DigitalDevices/.DS_Store index f459e15..2b11151 100644 Binary files a/OtherDevices/DigitalDevices/.DS_Store and b/OtherDevices/DigitalDevices/.DS_Store differ diff --git a/OtherDevices/DigitalDevices/DigitalSensors/ExternalDigitalSensorButton.cpp b/OtherDevices/DigitalDevices/DigitalSensors/ExternalDigitalSensorButton.cpp index 203a5ac..077d4de 100644 --- a/OtherDevices/DigitalDevices/DigitalSensors/ExternalDigitalSensorButton.cpp +++ b/OtherDevices/DigitalDevices/DigitalSensors/ExternalDigitalSensorButton.cpp @@ -1,7 +1,8 @@ // // 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" //ExternalDigDevice///////////////////////// @@ -14,7 +15,7 @@ int ExternalDigitalSensorButton::getState(){ } void ExternalDigitalSensorButton::setState() { - if (ifstream ("D:\\Documents\\Etudes\\INSA\\4A\\BECpp\\Projet_VictorAvecUnK\\src\\on.txt")){ + if (ifstream (PATH)){ state = HIGH; } else { state = LOW; @@ -27,4 +28,4 @@ void ExternalDigitalSensorButton::run() { *ptrmem = this->getState(); sleep(temps); } -} \ No newline at end of file +} diff --git a/board.cpp b/board.cpp index d228dcf..6f6ee08 100644 --- a/board.cpp +++ b/board.cpp @@ -18,7 +18,7 @@ int main(){ AnalogSensorLuminosity luminosite(DELAY); ExternalDigitalSensorButton button(DELAY); AnalogSensorManometre manometre(4,DELAY); - //DigitalActuatorRadiator radiator( + DigitalActuatorRadiator radiator(DELAY, THRESHOLDHIGH, THRESHOLDLOW); // branchement des capteurs actionneurs @@ -28,6 +28,7 @@ int main(){ esp8266.i2c(1,screen); esp8266.pin(4, button); esp8266.pin(5, manometre); + esp8266.pin(6, radiator); // allumage de la carte esp8266.run(); diff --git a/core_simulation.h b/core_simulation.h index 58cc60b..4be9011 100644 --- a/core_simulation.h +++ b/core_simulation.h @@ -13,6 +13,8 @@ #define MAX_I2C_DEVICES 4 #define I2C_BUFFER_SIZE 1024 #define MAX_IO_PIN 6 +#define THRESHOLDHIGH 25 +#define THRESHOLDLOW 15 using namespace std; diff --git a/include/.DS_Store b/include/.DS_Store index a18ff60..3ceb2d9 100644 Binary files a/include/.DS_Store and b/include/.DS_Store differ diff --git a/include/DigitalDevices/.DS_Store b/include/DigitalDevices/.DS_Store new file mode 100644 index 0000000..f459e15 Binary files /dev/null and b/include/DigitalDevices/.DS_Store differ diff --git a/sketch_ino.cpp b/sketch_ino.cpp index 49216cd..f8bf806 100644 --- a/sketch_ino.cpp +++ b/sketch_ino.cpp @@ -6,10 +6,12 @@ void Board::setup(){ // on configure la vitesse de la liaison Serial.begin(9600); // on fixe les pin en entree et en sorite en fonction des capteurs/actionneurs mis sur la carte - pinMode(1,INPUT); - pinMode(0,OUTPUT); - pinMode(2,INPUT); + pinMode(1, INPUT); + pinMode(0, OUTPUT); + pinMode(2, INPUT); pinMode(4, INPUT); + pinMode(5, INPUT); + pinMode(6, OUTPUT); } // la boucle de controle arduino @@ -20,8 +22,8 @@ void Board::loop(){ static int cpt=0; static int bascule=0; int i=0; - for(i=0;i<10;i++){ - if (i%3==0) { + //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); @@ -31,18 +33,18 @@ void Board::loop(){ val = analogRead(2); sprintf(buf, "luminosite %d", val); Serial.println(buf); - } + // } - if(cpt%5==0){ + // if(cpt%5==0){ // tous les 5 fois on affiche sur l ecran la temperature sprintf(buf,"%d",val1); bus.write(1,buf,100); - } + // } cpt++; sleep(1); - } + //} // on eteint et on allume la LED if(analogRead(4)) digitalWrite(0,HIGH);