Send Float value from SLIDER in Dashboard to Arduino


#1

Dear,

I am new to Cayenne and would like to send the data of a slider in the Dashboard that is a float value to my arduino.

CAYENNE_IN(VIRTUAL_CHANNEL)
{
int value = getValue.asInt();
Serial.print("Received from Cayenne : ");
Serial.println(value);
}

The code above works fine when I use a integer.
But I need to use a float.

CAYENNE_IN(VIRTUAL_CHANNEL)
{
float value = getValue.asFloat();
Serial.print("Received from Cayenne : ");
Serial.println(value);
}

DOESN’T WORK

Can you help me please ?

thanks


#2

try getValue.asDouble();


#3

YES…it works !

Thanks a lot.

Best Regards,
Pascal