ESP8266 and DS18B20

I am trying to hook up my ESP8266 with a DS18B20 temperature sensor. I have seen in the forums that others have had issues but my error seems different. I can build the sketch but it won’t connect to wifi. I have confirmed with a basic ESP8266 that the board will connect to my Cayenne dashboard but with the DS18B20 code it keeps saying it kind find the DHCP server?

Cayenne DS18B20 Example

This sketch shows how to send DS18B20 Sensor data to the Cayenne Dashboard.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

1. Install the OneWire library ( from the Arduino Library Manager.
2. Install the DallasTemperature library ( from the Arduino Library Manager.
3. Attach a DS18B20 to a digital pin on your Arduino.
   [Ground] -- [DS18B20] -- [4.7k resistor] -- [5V]
              Digital Pin
4. Set the SENSOR_PIN value below to the pin number you used when connecting the sensor.
5. Set the VIRTUAL_CHANNEL value below to a free virtual channel (or the virtual channel of a DS18B20 Sensor widget you have added) in the Dashboard.
6. Set the Cayenne authentication info to match the authentication info from the Dashboard.
7. Compile and upload this sketch.
8. Once the Arduino connects to the Dashboard it should automatically create a temporary display widget (or update the DS18B20 Sensor widget you have added) with data.
   To make a temporary widget permanent click the plus sign on the widget.

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <OneWire.h>
#include <DallasTemperature.h>
#include <CayenneMQTTESP8266.h>

// WiFi network info.
char ssid[] = "TP-LINK_19FC";
char wifiPassword[] = "72731628";

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "9da66af0-74a3-11e7-8230-efa4c0c056b2";
char password[] = "6e6a62ac9d67f17282cbea3befd685412ffae409";
char clientID[] = "6108ff80-1de5-11ee-8485-5b7d3ef089d0";

#define SENSOR_PIN 2 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.

OneWire oneWire(SENSOR_PIN);
DallasTemperature sensors(&oneWire);

void setup()
	Cayenne.begin(username, password, clientID);

void loop()

// This function is called at intervals to send sensor data to Cayenne.
	// Send the command to get temperatures.
	// This command writes the temperature in Celsius to the Virtual Channel.
	Cayenne.celsiusWrite(VIRTUAL_CHANNEL, sensors.getTempCByIndex(0));
	// To send the temperature in Fahrenheit use the corresponding code below.
	//Cayenne.fahrenheitWrite(VIRTUAL_CHANNEL, sensors.getTempFByIndex(0));