0

I have connected up my temperature sensor and I am trying to run the one wire address finder to find the address of the sensor.

The problem is that when I run the code it gives me the error: 'OneWire' does not have a type.

I have imported by the temperature and the onewire libraries but it still does not work.

#include <OneWire.h>

OneWire ds(6);  // This is where the error is
  • I assume this a compile-time, not run-time, message? Please copy/paste it. What OneWire library are you using? Were there any other error messages, especially any about OneWire.h not being found? – JRobert Jun 5 '14 at 19:54
1

I presume the exact error you get is

error: 'OneWire' does not name a type

This error is typical when the OneWire library (or any other library for that matter) is not located under the libraries folder, which should be at the root of the Arduino installation folder.

Also, make sure that the OneWire.h and OneWire.cpp files are 1 folder down the hierarchy, as follows:

[Arduino Installation Folder]\libraries\OneWire\OneWire.h

If they are nested deeper inside the folder hierarchy, the Arduino IDE will not find these files in its initial scan, and you will get the same error.

Make sure to close all Arduino IDE windows and re-open it after fixing the folder path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.