This commit is contained in:
Sergio Pernas 2022-09-06 13:04:41 -03:00
parent d7ee7c5447
commit ce2e217e72
4 changed files with 106 additions and 2 deletions

View file

@ -64,5 +64,5 @@ void loop() {
} }
} }
delay(100);
} }

View file

@ -17,9 +17,9 @@ void loop() {
inQuery = Serial.read(); inQuery = Serial.read();
if ( inQuery == devID) { if ( inQuery == devID) {
Serial.write("1"); Serial.write("1");
delay(100);
} }
} }
} }

BIN
Debug/placa_mod_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

@ -0,0 +1,104 @@
#include <OneWire.h>
#include <DallasTemperature.h>
#define address 99 //default I2C ID number for EZO pH Circuit.
// SENSOR TEMPERATURA
// Pin donde se conecta el bus 1-Wire
const int pinDatosDQ = 2;
// Instancia a las clases OneWire y DallasTemperature
OneWire oneWireObjeto(pinDatosDQ);
DallasTemperature sensorDS18B20(&oneWireObjeto);
// Funcion que llama al sensor de temperatura
float getDataTemp() {
sensorDS18B20.requestTemperatures();
return (sensorDS18B20.getTempCByIndex(0));
}
// SENSOR TURBIDEZ
// Funcion que llama al sensor de turbidez
int getDataTur() {
int sensorValue = analogRead(A7);
return (map(sensorValue, 0, 700, 100, 0));
}
//
char devIDstr[5];
int inQuery;
void setup() {
Serial.begin(9600);
// Sensor temperatura
sensorDS18B20.begin();
}
void loop() {
if ( Serial.available() > 0) {
inQuery = Serial.read();
switch (inQuery) {
case 1:
Serial.write("1");
Serial.write(" ");
Serial.write("T");
Serial.write(" ");
Serial.write("26.3");
Serial.write(" ");
Serial.write("C");
Serial.write(" ");
Serial.write("99");
break;
case 2:
Serial.write("2");
Serial.write(" ");
Serial.write("Tur");
Serial.write(" ");
Serial.write("26");
Serial.write("1235");
Serial.write("TSS");
Serial.write(" ");
Serial.write("99");
break;
case 3:
Serial.write("3");
Serial.write(" ");
Serial.write("Con");
Serial.write(" ");
Serial.write("26");
Serial.write("3425");
Serial.write("Con");
Serial.write(" ");
Serial.write("99");
break;
case 4:
Serial.write("4");
Serial.write(" ");
Serial.write("Ph");
Serial.write(" ");
Serial.write("26");
Serial.write("3425");
Serial.write("Ph");
Serial.write(" ");
Serial.write("99");
break;
default:
;
}
}
delay(100);
}