Page 1 of 1

using a checkbox

Posted: Wed Nov 22, 2017 10:19 am
by dogr127
Hi,

I am trying to used a checkbox which is set to send a command like this. "!my_checkbox [my_checkbox.Checked]\r\n"

In my arduino code I have the following line in the setup.
SerialCommandHandler.AddVariable(F("my_checkbox"), checked);

My question is what data type I should use for the variable 'checked'.
I tried boolean, but it gave me a compiling error.

d.

Re: using a checkbox

Posted: Wed Nov 22, 2017 10:40 am
by philr
Hi change your code to use this
[IPCheckBox1.Checked ? "1" : "0"]

That will send a 1 or 0 for true or false. I'm not sure if the addvariable supports Boolean but If not use an integer and do your logic on that.

Cheers
Phil

Re: using a checkbox

Posted: Wed Nov 22, 2017 11:41 pm
by dogr127
Thanks Phil!

Now, it is working.

d.