[SOLVED] Error in compilation and connecting stopped Arduino Uno+Ubidots


#1

Hi, i have a problem when i loading my code to Arduino Uno

  1. warning: invalid conversion from 'const char’ to 'char’ [-fpermissive]**
    float led_state = client.getValue(DEVICE_LABEL, LED);

but using as an example from original github code for variable and function, what i do wrong?
char const * DEVICE_LABEL = “arduino-ethernet”;
char const * LED = “led”;
float led_state = client.getValue(DEVICE_LABEL, LED);

  1. The second problem is connection stopped after one-two loops when i’m sending data to ubidots if i use getValue() method after sendAll(), but if i’m using sendAll() method again before delay() it works perfect, loop code
    /* Start the Ethernet connection */
    while (Ethernet.begin(mac) == 0) {
      Serial.println("Failed to configure Ethernet using DHCP");
      /* Try to configure using IP address instead of DHCP */
      Ethernet.begin(mac, ip);
      delay(5000);
    }
    /* Connect the client */
    client.connect();
  }

  /* Sensors readings */
  float temp = dht.readTemperature();
  float hum = dht.readHumidity();
  /* Sending values to Ubidots */
  client.add(TEMPERATURE, temp);
  client.add(HUMIDITY, hum);
  client.sendAll();

  float led_state = client.getValue(DEVICE_LABEL, LED);
  Serial.print("the value received is:  ");
  Serial.println(led_state);
  
  if(led_state == 1.0)
  {
    Serial.println("LED ON");
    digitalWrite(LED_PIN, HIGH);
  }
  else
  {
    Serial.println("LED OFF");
    digitalWrite(LED_PIN, LOW);
  }
 
  client.sendAll();
  delay(5000);

#2

Hello @tatardamir,

The first point mentioned show just a warning message, but it should not bring you any issue during the compilation process. If you desire to above the warning message you can modify constant declarations as is shown below:

/* Assigns the Ubidots parameters */
char TOKEN[]= "Assign_your_Ubidots_TOKEN_here"; // Assign your Ubidots TOKEN
char DEVICE_LABEL[] = "Assign_device_label_here"; // Assign the unique device label
char VARIABLE_LABEL[] = "Assign_variable_label_here"; // Assign the unique variable label to get the last value

Referring to the second point, we found out a memory issue into the library which is already fixed. The library is waiting the revision of our CTO, once the library is available I will let you know!

All the best,
Maria C.


#3

The Library is available at the Ubidots Repository, please go to the following link to download the new version. Everything is working properly, so you should not have any issue getting started with it.

All the best,
Maria C.