Pages: 1 ... 7 8 [9]   Go Down
Author Topic: DS18B20 & onewire.h  (Read 11199 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there,

I see it has been almost a month since anyone posted to this thread. I have a similar project that uses 10 DS18B20 sensors as input to a temperature control system. I've skimmed almost all of this thread hoping to reach the end to find the answer... but it seems the story isn't over yet.

so I'm wondering... did you ever get this system working as intended?

So far I've found a working sketch to list the addresses of all 10 of my sensors but haven't taken the next step in the software.

I'm using the Arduinio ver 1.0 software and I'm a bit confused about compatibility between that version of the Arduinio software and the DallasTemperature.h file I downloaded. I don't find any comments indicating a version number of the .h file or a version number for the OneWire.h file. I think I have the most recent version of both files.

However, a note on the vendor's web site, from which I bought the sensors. says the DallasTemperature.h and OneWire.h files are not compatible with the Arduino ver 1.0 software.

Is there an easy way to determine if I have the proper software loaded to write a program to read and report temperature readings from all 10 sensors?

Thanks,
Peter H.
Sandpoint, Idaho
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1074
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Peter

I've got a sketch running with 2 sensors using the dallas libraries and it works fine using the mechanism above to report the value of each specific one (one sensor inside and one on the roof at the far end of 30.5m of cable). 

I can't remember if I had to modify them to work with IDE 1.0 or not, so I suspect it worked fine out of the box.  Give it a crack anyway, it won't be a big change if there's one needed.

Cheers !
Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To compile under version 1.0 of the IDE:

Change the includes at the start of OneWire.cpp to be:

Code:
#include "OneWire.h"

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

extern "C" {
  #include <avr/io.h>
  #include <avr/interrupt.h>
  #include <avr/pgmspace.h>
}

Change the includes at the start of DallasTemperature.cpp to be:

Code:
#include "DallasTemperature.h"

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

Then it should compile OK.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wonderful. Thanks for the responses. I'll get back onto this project this evening!

Peter H.
Sandpoint
Logged

Pages: 1 ... 7 8 [9]   Go Up
Jump to: