 #include "Cosa/OWI/Driver/DS18B20.hh"
 #include "Cosa/Socket/Driver/W5100.hh"
 
+// Disable SD on Ethernet Shield
+#define USE_ETHERNET_SHIELD
+#if defined(USE_ETHERNET_SHIELD)
+#include "Cosa/OutputPin.hh"
+OutputPin sd(Board::D4, 1);
+#endif
+
 // One-wire pin and connected DS18B20 device
-OWI owi(Board::D14);
-DS18B20 sensor(&owi);
+OWI owi(Board::D7);
+
+// The devices connected to the one-wire bus
+DS18B20 outdoors(&owi);
+DS18B20 indoors(&owi);
+DS18B20 basement(&owi);
+
+DS18B20* thermometer[] = {
+  &outdoors,
+  &indoors,
+  &basement
+};
 
 // Network configuration
 #define MOSQUITTO "test.mosquitto.org"

  // Start MQTT client with socket and connect to server
  client.begin(ethernet.socket(Socket::TCP));
  client.connect(SERVER, CLIENT);

  // Publish data with the different quality of service levels
  client.publish_P(PSTR("public/cosa/client"), CLIENT, sizeof(CLIENT));
}

void loop()
{
  // Request a conversion and read the temperature
  sensor.convert_request();
  sensor.read_scratchpad();

  // Use an iobuffer and iostream to convert temperature to a string
  IOBuffer<16> buf;
  IOStream cout(&buf);
  cout << sensor << PSTR(" C") << ends;

  // Publish the value to the MQTT server and take a nap
  client.publish(PSTR("public/cosa/temperature"), buf, buf.available());
  sleep(5);
}

{
  Watchdog::begin();

  // Connect the sensors and set resolution to 10-bits
  for (uint8_t i = 0; i < membersof(thermometer); i++) {
    thermometer[i]->connect(i);
    thermometer[i]->set_resolution(10);
    thermometer[i]->write_scratchpad();
  }

  // Start ethernet controller and request network address for hostname
  ethernet.begin_P(CLIENT);
