Error Compiling, Onewire.h: No such file or direct

Dear Arduino friends

I'm trying to compile a program for Temperature Sensor Dallas D18B20.

However, the compiler fails with the error

P: \ Tools41 \ Arduino \ Arduino Software \ hardware \ libraries \ DallasTemperature_340 \ DallasTemperature.h: 20:21: error: OneWire.h: No such file or directory

What is wrong?

I downloaded the latest libraries for Dallas and Onewire, and placed them in the folder I think they should be in.

In addition, I specify the full path in my code:

#include <P:\Tools41\Arduino\Arduino Software\hardware\libraries\OneWire\OneWire.h>;
#include <P:\Tools41\Arduino\Arduino Software\hardware\libraries\DallasTemperature_340\DallasTemperature.h>;

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 53

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");

// Start up the library
sensors.begin();
}

void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");

Serial.print("Temperature for Device 1 is: ");
Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire

}

Hope for a little help from my friends :slight_smile:

Did you restarted the arduino GUI after you added the libraries?

EriSan500

Yes, i have restarted my development environment.

Sune

Taking out the full paths, the code compiles fine on my system.

In what folder did you place the One Wire folder? I do not see a hardware/libraries directory in my Arduino folder. I see hardware and libraries as two separate folders.

UPDATE: I placed the OneWire folder into arduino-0018\libraries. Then you MUST close aruduino, restart it, then compile. When adding new files to the library you must restart arduino so it can adjust to changes. This eliminates wasting time and software debugging thats not particularity necessary :slight_smile:

In addition, I specify the full path in my code:

#include <P:\Tools41\Arduino\Arduino Software\hardware\libraries\OneWire\OneWire.h>;
#include <P:\Tools41\Arduino\Arduino Software\hardware\libraries\DallasTemperature_340\DallasTemperature.h>;

For future reference:

Don't type in the #include statements.

After putting the libraries in the proper places and restarting Arduino, load your sketch (without the #includes).

Then go to the Sketch->Import Library menu item and select the library from the list. If the library does not appear in the list, it's in the wrong place in the directory tree. If it can find it, Arduino will helpfully insert the #include statement at the top of your sketch.

Regards,

Dave

There are three types of .extention , .c .cpp and .h
For .h use " double quotes " not

Try this with your file path extentions and it should work, but then try again with file name only to verify you have library in libraryand prog in core and they are all standard. If you pasted a code with <OneWire.h> from someones code...it would appear they posted a non compile tested version.