Error: 'OneWire' has not been declared

OneWire is not recognized:

#include <OneWire.h>
#include <DallasTemperature.h>

const int oneWireBus = 2;
OneWire oneWire(oneWireBus );

My Configfile is:

[env:d1_mini_pro]
platform = espressif8266
board = d1_mini_pro
framework = arduino
monitor_speed = 115200
lib_deps = 
	adafruit/Adafruit AHTX0@^2.0.1
	adafruit/Adafruit BMP280 Library@^2.6.8
	bblanchon/ArduinoJson@^6.21.2
	adafruit/DHT sensor library@^1.4.6
	adafruit/Adafruit Unified Sensor@^1.1.14
	milesburton/DallasTemperature@^3.11.0
	paulstoffregen/OneWire@^2.3.8

When I am building the code the following error will be present:
error: ‘OneWire’ has not been declared, error: ‘OneWire’ does not name a type

Can anyone help out there? Thanks

Can you show the full error log, please?

Hi, its solved I named my headerfile with some OneWire functions oneWire.h which had some conflicts with the original one OneWire.h. Thats why it did not work. I just had to rename my headerfile and it worked

1 Like