Sending decimal value to arduino

Support forum for MegunoLink
Post Reply
Pelle8879
Posts: 3
Joined: Wed Mar 21, 2018 8:56 pm

Thu Feb 07, 2019 6:02 am

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
philr
Posts: 280
Joined: Mon May 26, 2014 10:58 am

Thu Feb 07, 2019 6:31 am

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
Post Reply