-
Notifications
You must be signed in to change notification settings - Fork 2
6. Extra Libraries
Since the native I²C pins on the ESP8266 module is use for other purposes, the only way you could use an I²C peripheral is to use Soft-I²C over the GPIO expansion chip.
To mitigate this issue, the uNode library comes with a built-in override to the Wire.h
header, that uses the software implementation capable to operate both on native and extended pins.
To use the custom Wire.h
library you should include it before including other libraries that depend on it. For example:
#include <uNode.hpp>
#include <Wire.h> // This will be sourced from the uNode library
void setup() {
uNode.setup();
Wire.begin(
D2, // SDA Pin
D3 // SCL pin
);
...
}
If are using a DHT sensor in your project, you can use the built-in DHT
library that can be used seamlessly either for built-in pins (D0
, D1
), or over GPIO (D2
to D9
).
To use the DHT library use the uNode/libraries/DHT.hpp
header right after sourcing the uNode.hpp
header:
#include <uNode.hpp>
#include <uNode/libraries/DHT.hpp>
// You can use either a built-in pin or an extended GPIO pin as
// the sensor pin
DHT dht(D2, DHT22);
void setup() {
uNode.setup();
dht.begin():
...
}
This is a customised clone of the upstream Adafruit DHT Library. Refer to it for the API reference.