Problem with connecting Arduino Yun

Problems connecting Arduino Yun to Cayenne. Initially adding the device “Arduino Yun” works fine but when I try and add a sensor (temp36) the Serial monitor responds with:
Unable to connect: retrying (1)…
Unable to connect: retrying (2)…
Unable to connect: retrying (3)…
Unable to connect: retrying (4)…
Unable to connect: is the sketch using the bridge?

I have tried changing #define CAYENNE_DOMAIN “Arduino.mydevices.com” to the #CAYENNE_DOMAIN “54.174.252.197” as seen in another post, to no effect so reverted back to the original
Also added varies port forwarding rules to my routers/firewall’s port forwarding list.
I have tried accessing the Yun via the Rest commands from outside my local network and that works fine, so presume that there are no internet connection issues?

Any suggestions would be welcome.
Thanks Bengt (South Africa)

Welcome to Cayenne!

Are you saying then when you use the default (empty) sketch that Yun connects to the dashboard and it shows up as online? Can you post your code for us to review?

Hi,

Yes initially adding the Yun is successful, but when I then try and add a
sensor (example Tmp36) and us/upload the demo code that is created it then
does not want to connect. See code below:

/*
Cayenne TMP36 Example

This sketch shows how to send temperature data to a TMP36 Sensor in the
Cayenne Dashboard.

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

Steps:
1. In the Cayenne Dashboard add a new TMP36 widget.
2. Set the widget to Value Display.
3. Select Virtual Pins and a virtual pin number.
4. Set VIRTUAL_PIN to the pin number you selected.
5. Attach a TMP36 to an analog pin on your Arduino. Make sure to use an
analog pin, not a digital pin.
   Schematic:
   [Ground] -- [TMP36] -- [5V]
                  |
              Analog Pin
6. Set the tmpPin variable to match the pin used to connect the TMP36.
7. Set the voltage variable to match the voltage used to connect the TMP36.
8. Set the token variable to match the Arduino token from the Dashboard.
9. Compile and upload this sketch.
10. Once the Arduino connects to the Dashboard it should automatically
update the TMP36 widget with data.
*/

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

// If you're not using the Ethernet W5100 shield, change this to match your
connection type. See Communications examples.
#include <CayenneEthernet.h>

// Cayenne authentication token. This should be obtained from the Cayenne
Dashboard.
char token[] = "XXXXXXX";

// Virtual Pin of the TMP36 widget.
#define VIRTUAL_PIN V1

// Analog pin the TMP36 is connected to.
const int tmpPin = 0;

// Voltage to the TMP36. For 3v3 Arduinos use 3.3.
const float voltage = 5.0;

TMP36 tmpSensor(tmpPin, voltage);

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token);
}

void loop()
{
  Cayenne.run();
}

// This function is called when the Cayenne widget requests data for the
Virtual Pin.
CAYENNE_OUT(VIRTUAL_PIN)
{
  // This command writes the temperature in Celsius to the Virtual Pin.
  Cayenne.celsiusWrite(VIRTUAL_PIN, tmpSensor.getCelsius());
  // To send the temperature in Fahrenheit or Kelvin use the corresponding
code below.
  //Cayenne.fahrenheitWrite(VIRTUAL_PIN, tmpSensor.getFahrenheit());
  //Cayenne.kelvinWrite(VIRTUAL_PIN, tmpSensor.getKelvin());
}

Thanks

Bengt