Page 1 of 1

Sending decimal value to arduino

Posted: Thu Feb 07, 2019 6:02 am
by Pelle8879
How can I send a float value (ex 5,4) from megunolink and have arduino to understand that?
I have tested this but the value vill only be integer.
void Cmd_SetDmin(CommandParameter &Parameters)
{
Dmin = atof(Parameters.NextParameter());
}

And this is what meguno is sending:
!SetDVmax 4.5

Re: Sending decimal value to arduino

Posted: Thu Feb 07, 2019 6:31 am
by philr
Hi Pelle, that should have worked. You could try

Dmin = Parameters.NextParameterAsDouble();

Which basically does the same thing. Are you sure Dmin is a float? Also make sure the message has a ! at the start and a \r at the end.

Cheers
Phil