complete beginner, roadblock with "#include <OneWire.h>"

Hi, first post here, and I hope I’m posting in the correct subforum. If not, please advise a more appropriate one.

I’ve just wired up my first project, which simply involved replicating the setup shown here.

I’m using a leonardo board, and am using a micro usb cable to connect to my PC, and the “ON” LED is a solid green. The adjacent “L” LED is blinking orange.

For software, I’m using Arduino 1.0.6.

My device manager (windows 7) tells me that COM 5 is being used for the arduino, so in the arduino software, I’ve changed the serial port to COM 5 (and I’ve also changed the board to match mine).

Now when I try to verify the first line of code from the first link, I get the following error message (this is just the first line of the error message):

C:\Program Files (x86)\Arduino\libraries\OneWire\OneWire.cpp:85:24: error: WConstants.h: No such file or directory

This is when it tries to compile the following line:

#include <OneWire.h>

I’ve googled this error message, and found this instruction:

When compile an Arduino Library, it fails to compile with the message:

error: WConstants.h: No such file or directory

The solution is to delete the line

#include “WConstants.h”

and then in the .h file, add the following:

#if ARDUINO >= 100
#include “Arduino.h”
#else
#include “WProgram.h”
#endif

This way, the code will compile, and it will be compatible to Arduino 0023 and 1.0 versions.

I’m not sure which .h file it’s referring to, but I went ahead and added those lines to the OneWire.h file. I couldn’t find any instance of “WConstants.h” in that file, so I wasn’t able to remove that line (although I think they meant to remove the line from the sketch code).

Upon rerunning the code, the error msg is much shorter - now the whole error message is that one line:

C:\Program Files (x86)\Arduino\libraries\OneWire\OneWire.cpp:85:24: error: WConstants.h: No such file or directory

I know nothing about C programming, I only know Matlab. But I can’t get matlab to work with arduino for some reason. It’s giving me an error msg saying I need to have the sketch running at the same time.

Can anyone guide me here? Sorry, I know this posts just reeks of beginner!

Your OneWire library is ancient, get a recent version and replace the old one.

thanks, that got rid of that particular error message, but now this one shows:

core.a(main.cpp.o): In function `main': C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:40: undefined reference to `setup' C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:43: undefined reference to `loop'

never mind, I think that was from not having complete code. I pasted the entire code and getting a different error related to the dallas library. Will try to find a newer library and see if that fixes it.

Fixed, downloaded the latest dallastemperature library, renamed the folder to match the .h file, and it worked.

Thanks for the gentle kick in the ass :)