ds18b20 newbie

this is joel
i just started with the arduino uno
i can get the example blink to work properly on the uno
trying to get the ds18b20 temp sensor to work
i have the onewire library downloaded and installed
i get the error below, below that is the code i am using
also i am using windows xp, don't know if that makes a difference

Blink:4: error: 'OneWire' does not name a type
Blink.ino: In function 'void loop()':
Blink:18: error: 'ds' was not declared in this scope
Blink:30: error: 'OneWire' has not been declared

#include <OneWire.h>

// DS18S20 Temperature chip i/o
OneWire ds(10); // on pin 10 << error happens here

void setup(void) {
// initialize inputs/outputs
// start serial port
Serial.begin(9600);
}

void loop(void) {
byte i;
byte present = 0;
byte data[12];
byte addr[8];

if ( !ds.search(addr)) {
Serial.print("No more addresses.\n");
ds.reset_search();
return;
}

Serial.print("R=");
for( i = 0; i < 8; i++) {
Serial.print(addr*, HEX);*

  • Serial.print(" ");*
  • }*
  • if ( OneWire::crc8( addr, 7) != addr[7]) {*
  • Serial.print("CRC is not valid!\n");*
  • return;*
  • }*
  • if ( addr[0] == 0x10) {*
  • Serial.print("Device is a DS18S20 family device.\n");*
  • }*
  • else if ( addr[0] == 0x28) {*
  • Serial.print("Device is a DS18B20 family device.\n");*
  • }*
  • else {*
  • Serial.print("Device family is not recognized: 0x");*
  • Serial.println(addr[0],HEX);*
  • return;*
  • }*
  • ds.reset();*
  • ds.select(addr);*
  • ds.write(0x44,1); // start conversion, with parasite power on at the end*
  • delay(1000); // maybe 750ms is enough, maybe not*
  • // we might do a ds.depower() here, but the reset will take care of it.*
  • present = ds.reset();*
  • ds.select(addr); *
  • ds.write(0xBE); // Read Scratchpad*
  • Serial.print("P=");*
  • Serial.print(present,HEX);*
  • Serial.print(" ");*
  • for ( i = 0; i < 9; i++) { // we need 9 bytes*
    _ data = ds.read();_
    _ Serial.print(data*, HEX);
    Serial.print(" ");
    }
    Serial.print(" CRC=");
    Serial.print( OneWire::crc8( data, 8), HEX);
    Serial.println();
    }*_

A blinking led is already a good result. That means that everything is working.

This is the main page for OneWire: Arduino Playground - OneWire
The OneWire library is not included with the Arduino software, you have to add that.
http://arduino.cc/en/Guide/Libraries

Here is a good source. Note that there are two programmes, one to determine the built-in address, and the other to use the devices(es)

The "'OneWire' does not name a type" error means that OneWire.h is not being loaded. You either placed it in an incorrect directory, the file is corrupt, or need to restart your IDE.

got past the OneWire ds(10); // on pin 10 error
have this sketch built in the libraries directory so all libraries should be accessable
now i get this error using the above code

BareMinimum.ino: In function 'void loop()':
BareMinimum:26: error: call of overloaded 'print(byte [8], int)' is ambiguous
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:59: note: candidates are: size_t Print::print(unsigned char, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:60: note: size_t Print::print(int, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:61: note: size_t Print::print(unsigned int, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:62: note: size_t Print::print(long int, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:63: note: size_t Print::print(long unsigned int, int)
BareMinimum:62: error: incompatible types in assignment of 'uint8_t' to 'byte [12]'
BareMinimum:63: error: call of overloaded 'print(byte [12], int)' is ambiguous
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:59: note: candidates are: size_t Print::print(unsigned char, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:60: note: size_t Print::print(int, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:61: note: size_t Print::print(unsigned int, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:62: note: size_t Print::print(long int, int)
C:\arduino\arduino-1.0.5-r2-windows\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Print.h:63: note: size_t Print::print(long unsigned int, int)
BareMinimum:67: error: 'smiley' was not declared in this scope
BareMinimum:67: error: 'cool' was not declared in this scope