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.
|
||||
//
|
||||
|
||||
//#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
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
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue