[SOLVED] Getting Value '0' from a Slider

Hi everyone ,
I’m using Ubidots Library for Arduino Ethernet-shield.I’ve been dealing with a Problem about Slider Widget.The Value i get from slider is always ‘0’ .

int a=client.getValue(SliderID) – I also tried with float but i got the same result.

What may cause this Problem ? If you have any solutions for that it would be great.

Thanks in advance.

Hello @mubuca95,

Following the examples you have to get the value as a float. I just made a test and I’m not able to replay your issue. I’m using the sample code to get a value from ubidots provide on the library. Please verify if is the same that are you using, also verify the connectivity of the shield.

#include <Ethernet.h>
#include <SPI.h>
#include <UbidotsEthernet.h>
#define ID  "Variable_ID_here"  // Put here your Ubidots variable ID
#define TOKEN  "Ubidots_Token_here"  // Put here your Ubidots TOKEN


// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(172, 17, 0, 1);

Ubidots client(TOKEN);

void setup(){
    Serial.begin(9600);
    // start the Ethernet connection:
    if (Ethernet.begin(mac) == 0) {
      Serial.println("Failed to configure Ethernet using DHCP");
      // try to congifure using IP address instead of DHCP:
      Ethernet.begin(mac, ip);
    }
    // give the Ethernet shield a second to initialize:
    delay(1000);
}
void loop(){
    float value = client.getValue(ID);
    Serial.print("Final value: ");
    Serial.println(value);
}

As you can see on the image I’m able to get the slider values without any issue:

I hope this would help you.
Best Regards,
Maria C.