EcoRenovator  

Go Back   EcoRenovator > Improvements > Geothermal & Heat Pumps
Advanced Search
 


Blog Register 60+ Home Energy Saving Tips Recent Posts Search Today's Posts Mark Forums Read


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 01-03-16, 03:25 PM   #21
Acuario
Apprentice EcoRenovator
 
Join Date: May 2011
Location: Tortosa, Spain
Posts: 218
Thanks: 2
Thanked 75 Times in 44 Posts
Default

7. DS18B20.ino - you will need to put in your own addresses for your sensors
#include <OneWire.h>
#include <DallasTemperature.h>

// Initialize OneWire
OneWire one_wire(DS18B20);
DallasTemperature sensors(&one_wire);

// OneWire Sensor addresses
//28 71 94 2B 06 00 00 2C
//28 81 15 31 04 00 00 34
DeviceAddress compressor = { 0x28, 0x71, 0x94, 0x2B, 0x6, 0x0, 0x0, 0x2C };
DeviceAddress evaporator = { 0x28, 0x81, 0x15, 0x31, 0x4, 0x0, 0x0, 0x34 };

NIL_THREAD(threadReadSensors, arg) {
while (TRUE) {
//Serial.println("Read DS18B20 sensors");
sensors.requestTemperatures();
tempCompressor = sensors.getTempC(compressor);
tempEvaporator = sensors.getTempC(evaporator);
//Serial.println(tempCompressor);
//Serial.println(tempEvaporator);
if (tempCompressor != lastTempCompressor) {
lastTempCompressor = tempCompressor;
}
if (tempEvaporator != lastTempEvaporator) {
lastTempEvaporator = tempEvaporator;
}
// Sleep for 10 seconds.
nilThdSleepSeconds(10);
}
}

Acuario is offline   Reply With Quote
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Ad Management by RedTyger
Inactive Reminders By Icora Web Design