Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////Inclusão de bibliotecas///////////////////////////////
- #include <OneWire.h>
- #include <DallasTemperature.h>
- #include <dht.h>
- ////Definir sensores////////////////////////////////
- #define ONE_WIRE_BUS 3
- OneWire oneWire(ONE_WIRE_BUS);
- DallasTemperature sensors(&oneWire);
- dht DHT;
- /////Endereço sensores dsb18//////////////////////////
- DeviceAddress InThermo = {
- 0x28, 0xFF, 0x32, 0x0A, 0x8B, 0x16, 0x03, 0x53
- };
- DeviceAddress OutThermo = {
- 0x28, 0xFF, 0x7B, 0x97, 0x93, 0x16, 0x04, 0xD9
- };
- //temperature variables/////////////////////////////////
- float InTemp, OutTemp, diff, drain, flow, power, tempC;
- void setup(void)
- {
- Serial.begin(9600);
- Serial.println("LABEL,Time,TempIn[°C],TempOut[°C],Dif. Temp[°C],Humidade[%],Temp. Amb[C]");
- sensors.begin();
- sensors.setResolution(InThermo, 12);
- sensors.setResolution(OutThermo, 12);
- }
- void loop(void)
- {
- Serial.print("DATA,TIME,");
- delay(3000);
- //Get the sensor readings. There are two of them
- sensors.requestTemperatures();
- DHT.read11(A0);
- GetandPrint(InThermo);
- InTemp=tempC;
- GetandPrint(OutThermo);
- diff = tempC - InTemp;
- delay(3000);
- }
- void GetandPrint(DeviceAddress deviceAddress)
- {
- Serial.print (abs(diff));
- Serial.println(" , ");
- Serial.print(DHT.humidity);
- Serial.println(" , ");
- Serial.print(DHT.temperature);
- Serial.println(" , ");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement