Go Down

Topic: OneWire error message (Read 1 time) previous topic - next topic


I'm new to Arduino and I'm trying to get the address for a onewire temp probe.

When I try to verify the one_wire_address_finder code in arduino 1.03 I get the following errors

one_wire_address_finder:9: error: 'OneWire' does not name a type
one_wire_address_finder.pde: In function 'void discoverOneWireDevices()':
one_wire_address_finder:23: error: 'ds' was not declared in this scope
one_wire_address_finder:35: error: 'OneWire' has not been declared
one_wire_address_finder:41: error: 'ds' was not declared in this scope

Code is below

// This sketch looks for 1-wire devices and
// prints their addresses (serial number) to
// the UART, in a format that is useful in Arduino sketches
// Tutorial:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

#include <OneWire.h>

OneWire  ds(3);  // Connect your 1-wire device to pin 3

void setup(void) {

void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  Serial.print("Looking for 1-Wire devices...\n\r");
  while(ds.search(addr)) {
    Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");
    for( i = 0; i < 8; i++) {
      if (addr < 16) {
      Serial.print(addr, HEX);
      if (i < 7) {
        Serial.print(", ");
    if ( OneWire::crc8( addr, 7) != addr[7]) {
        Serial.print("CRC is not valid!\n");
  Serial.print("\n\r\n\rThat's it.\r\n");

void loop(void) {
  // nothing to see here

I know its probably something simple I'm missing.

Any help you can give me would be greatly appreciated




Did you download and install the OneWire library? Where?
The art of getting good answers lies in asking good questions.


Thank you

I knew it was simple.  I put the library in the right spot and it works now.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131