Hello,
I can’t find the function for read real numbers.
I read integer:
CAYENNE_IN(1)
{
x=getValue.asInt();
}
I have no idea, how read the floating point number. Could you help me?
Hello,
I can’t find the function for read real numbers.
I read integer:
CAYENNE_IN(1)
{
x=getValue.asInt();
}
I have no idea, how read the floating point number. Could you help me?
@shramik_salgaonkar or @tad.dvor might be able to help here
Try this:
CAYENNE_IN(1)
{
CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, getValue.getId(), getValue.asString());
if (request.channel = 1)
{
String value0;
value0 = (String)getValue.asString();
Serial.println(value0);
}
}
Thank you very much! I add conversion string to float and work very well
CAYENNE_IN(1)
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) - %s, %s”, request.channel, getValue.getId(), getValue.asString());
if (request.channel = 1)
{String value0; value0 = (String)getValue.asString();
x=value0.toFloat();
}
}
CAYENNE_IN(1)
{
float x=getValue.asDouble();
}
CAYENNE_IN(1)
{
float x=getValue.asDouble();
}
Great!
@shramik_salgaonkar, thank you, it works well!