Writing temperature to a virtual pin stops upload to arduino


#1

Hi Cayenne Community,
I am using arduino since quite some time sucessfully and tried today first time Cayenne. I have following HW setup:
Arduino Uno + Ethernetshile 1.1 (with ENC28J60)
Digital pin 2 connects with a pull-up to a DS18B20
I was using following sketch:

    
    #include 
    #include 
    #include 
    #include 
    #include 

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

    // Digital pin the DS18B20 is connected to. Do not use digital pins 0 or 1 since those conflict with the use of Serial.
    const int tmpPin = 2;

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

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

    void setup()
    {
      Serial.begin(9600);
      Cayenne.begin(token);
      sensors.begin();
    }
    // This function is called when the Cayenne widget requests data for the Virtual Pin.
    CAYENNE_OUT(VIRTUAL_PIN)
    {
      // Send the command to get temperatures.
      sensors.requestTemperatures();
      // This command writes the temperature in Celsius to the Virtual Pin.
      Cayenne.celsiusWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));
      // To send the temperature in Fahrenheit use the corresponding code below.
      // Cayenne.fahrenheitWrite(VIRTUAL_PIN, sensors.getTempFByIndex(0));
    }
    void loop()
    {
      Cayenne.run();
    }

It stops during upload with the very unspecific message that there was an error during upload of the sketch.

When I comment out the following line:

Cayenne.celsiusWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));

The upload works. Of course I don’t get any data, but there is a connection of the device visible.

Any idea where the cause could be?


#2

Hi @martin1, I know you mentioned it was unspecific, but do you mind sharing the exact error message output (a screenshot is fine) in case it does provide a hint to exactly what’s going on here?


#3

Hi rsiegel,
sure, I try to be es precise as possible… might be much content… :slight_smile:

this is the the error message I get… I hope my language setting is not a big problem… :laughing:

This is the error message I see, when the Virtuel Pin is used:

These are all the warnings I get then:

WARNUNG: Kategorie ‘’ in der Bibliothek UIPEthernet ist ungültig und wird auf ‘Uncategorized’ festgelegt
In file included from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPEthernet.h:33:0,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkSimpleUIPEthernet.h:19,

             from D:\Eigene Dateien\Documents\Arduino\Test-Cayenne1\Test-Cayenne1.ino:4:

C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPClient.h:25:2: warning: #import is a deprecated GCC extension [-Wdeprecated]

#import “Client.h”

^

In file included from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPEthernet.h:33:0,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkSimpleUIPEthernet.h:19,

             from D:\Eigene Dateien\Documents\Arduino\Test-Cayenne1\Test-Cayenne1.ino:4:

C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPClient.h:26:2: warning: #import is a deprecated GCC extension [-Wdeprecated]

#import “utility/mempool.h”

^

C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPClient.h:29:4: warning: #import is a deprecated GCC extension [-Wdeprecated]

#import “utility/uip.h”

^

In file included from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPEthernet.h:34:0,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkSimpleUIPEthernet.h:19,

             from D:\Eigene Dateien\Documents\Arduino\Test-Cayenne1\Test-Cayenne1.ino:4:

C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPServer.h:23:2: warning: #import is a deprecated GCC extension [-Wdeprecated]

#import “Server.h”

^

In file included from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPEthernet.h:34:0,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkSimpleUIPEthernet.h:19,

             from D:\Eigene Dateien\Documents\Arduino\Test-Cayenne1\Test-Cayenne1.ino:4:

C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPServer.h:24:2: warning: #import is a deprecated GCC extension [-Wdeprecated]

#import “UIPClient.h”

^

In file included from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/Blynk/BlynkApi.h:18:0,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkApiArduino.h:14,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/Adapters/BlynkEthernet.h:18,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkSimpleUIPEthernet.h:20,

             from D:\Eigene Dateien\Documents\Arduino\Test-Cayenne1\Test-Cayenne1.ino:4:

D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/Blynk/BlynkProtocolDefs.h:93:0: warning: “ntohs” redefined

     #define ntohs(x) htons(x)

^

In file included from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPUdp.h:28:0,

             from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/Dhcp.h:7,

             from C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/UIPEthernet.h:30,

             from D:\Eigene Dateien\Documents\Arduino\libraries\Cayenne/BlynkSimpleUIPEthernet.h:19,

             from D:\Eigene Dateien\Documents\Arduino\Test-Cayenne1\Test-Cayenne1.ino:4:

C:\Program Files (x86)\Arduino\libraries\arduino_uip-master/utility/uip.h:1087:0: note: this is the location of the previous definition

#define ntohs htons

^

Der Sketch verwendet 29.608 Bytes (91%) des Programmspeicherplatzes. Das Maximum sind 32.256 Bytes.
Globale Variablen verwenden 1.398 Bytes (68%) des dynamischen Speichers, 650 Bytes für lokale Variablen verbleiben. Das Maximum sind 2.048 Bytes.
Beim Hochladen des Sketches ist ein Fehler aufgetreten

When I comment the line out the warnings are almost identical except the last lines:

Der Sketch verwendet 25.412 Bytes (78%) des Programmspeicherplatzes. Das Maximum sind 32.256 Bytes.
Globale Variablen verwenden 1.380 Bytes (67%) des dynamischen Speichers, 668 Bytes für lokale Variablen verbleiben. Das Maximum sind 2.048 Bytes.

Any ideas what could cause that?

best regards,
Martin