I am looking for a general explanation of the onewire and dallas temperature libraries. I am very new to this and don't understand the example sketches very well. Even a listing of the key words and their general syntax would be helpful. There seems to be many example sketches but limited explanation.
for example the following statement;
// arrays to hold device addresses
DeviceAddress insideThermometer, outsideThermometer;
There is a slide show, click on the link for the Presentation:
You don't have to understand the Dallas Temperature libraries. The protocol for the DS18B20 contains a lot of magical numbers and timing, which I don't understand.
It might be a bit over the top to say it's the only tutorial that is any good but, as far as I'm concerned, it's the only tutorial that is any good. I had a bad time starting with DS18B20, and I don't think it is over the top to say there is is a lot of badly explained junk out there.
murmsk:
thanks, I have studied those. Is there a place that explains the keywords?
Probably not, but I only say this because I have never heard of keywords. All you need is in the link I provided . There is no reference to keywords therein, I guess this is because you don't need them.
// arrays to hold device addresses
DeviceAddress insideThermometer, outsideThermometer;
is DeviceAddress a keyword. I just don't understand this statement
No surprise there. It may be, but probably isn't, a keyword, it is most likely junk. I don't think you have read through the Hacktronics programme properly. Now is a really good time to do that, as the reference is perfectly clear.
DeviceAddress is a definition. It states what a device address is. Something = something
void printAddress(DeviceAddress deviceAddress)
{
for (uint8_t i = 0; i < 8; i++)
{
// zero pad the address if necessary
if (deviceAddress < 16) Serial.print("0");
_ Serial.print(deviceAddress*, HEX);_
_ }_
_}_
_ I don't understand the usage of DeviceAddress or deviceAddress*_ further deviceAddress is not defined anywhere that I can find steve
void printAddress(DeviceAddress deviceAddress)
{
for (uint8_t i = 0; i < 8; i++)
{
// zero pad the address if necessary
if (deviceAddress < 16) Serial.print("0");
_ Serial.print(deviceAddress*, HEX);_
_ }_
_}_
_ I don't understand the usage of DeviceAddress or deviceAddress*_ further deviceAddress is not defined anywhere that I can find [/quote] The line *_ <em>* for (uint8_t i = 0; i < 8; i++)*</em> _* suggests this is code to retrieve the address from the DS18B20, which is read in eight blocks . It comes from God knows where and not part of the material from Hacktronics. I suggest you stick with the latter. There is a link to the separate programme for that purpose therein.
This says that the printTemperature function requires one argument which must be of type DeviceAddress and in the function definition it will be referred to as deviceAddress. The definition of DeviceAddress in DallasTemperature.h means that the statement is exactly equivalent to:
void printTemperature(uint8_t deviceAddress[]) {
i.e. deviceAddress is a pointer to an array of unsigned characters, and specifically an array of length 8.
printTemperature (insideAddress);
This calls the function with an address which must have been defined, and filled in, earlier in the program.