Hi, i have a problem when i loading my code to Arduino Uno
-
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);
- 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);