#include <OzIDManager.h>
#include <OzDHTSensor.h>

// global pointers
OzIDManager* manager;
OzDHTSensor* dhtTemperature;
OzDHTSensor* dhtHumidity;

void setup()
{
  Serial.begin(115200);

  // instantiate objects
  manager = new OzIDManager;
  manager->_sendACK = true;
  manager->_checksum = true;

  OzCommunication::setIDManager(manager);
 
  //DHT11 sensor connected to D2 pin
  dhtTemperature = new OzDHTSensor(DHT11,DHTMode::Temperature,2);
  dhtHumidity = new OzDHTSensor(DHT11,DHTMode::Humidity,2);
  //Set it to DHT22 if using DHT22

  // welcome devices
  int x = 1;
  manager->sendLinkSetup();
  manager->PrintWelcomeLine(dhtTemperature, x++, "TemperatureSensor_1");
  manager->PrintWelcomeLine(dhtHumidity, x++, "HumiditySensor_1");
}

void loop()
{
  dhtTemperature->ownLoop();
  dhtHumidity->ownLoop();
  OzCommunication::communicate();
}

More information