Page 1 of 1

sending commands from my interface panel to my board

Posted: Sat Feb 02, 2019 5:10 am
by supershepp
So I'm having some issues writing a code to receive a value from my "number box" and put that value into an integer var within my code. I am able to make this work with command handler though my USB port but not through my UDP port.

Anyone has a clue?

Thanks

Re: sending commands from my interface panel to my board

Posted: Sat Feb 02, 2019 8:00 am
by philr
Hi Supershepp, would tcp work? Here is an example using tcp? This might be helpful
https://www.megunolink.com/documentatio ... d-handler/

There is also this example
https://github.com/Megunolink/MLP/blob/ ... mmands.ino

What hardware are you using?

Cheers
Phil

Re: sending commands from my interface panel to my board

Posted: Sat Feb 02, 2019 10:53 pm
by supershepp
I am working with an Ethernet shield.I figured i would go with UDP because I want meguno to broadcast commands to two ardurino network cards. Im sure i could this with TcP as well.

So i am able to send a value from my number box to my mega. Cool, but it only sends one command and i need to send two different.
When using serial this function works without any problems.

My number box will send the value of the number in the box. along with that command, i need an unlock command send at the same time. My code has a latching function within. it compares to number and when they are equal. it locks the controls. when a new value is sent, the "lock9bar" will send value "1" meaning to unlock and accept new value of the number box.

!Lock9bar [1]\r\n SetLoco9bar [GoToNum9bar.Value] \r

My code is only accepting one but not both.
Commands.AddVariable(F("SetLoco9bar"), Loco9bar);
Commands.AddVariable(F("Lock9bar"), Lock9bar);

how can i get my text box value into "loco9bar" and get my "1" into "Lock9bar"?

Re: sending commands from my interface panel to my board

Posted: Sun Feb 03, 2019 8:49 am
by philr
You missed a second ! in that example. Would that be the issue?

i.e. !Lock9bar [1]\r\n !SetLoco9bar [GoToNum9bar.Value]\r

Re: sending commands from my interface panel to my board

Posted: Sun Feb 03, 2019 8:42 pm
by supershepp
wish it was that simple. I had it configured that and it works sending over USB port. I will go back and change it so i can look in another place for the problem.