sending commands from my interface panel to my board

Support forum for MegunoLink
Post Reply
supershepp
Posts: 10
Joined: Mon Jan 07, 2019 12:12 am

Sat Feb 02, 2019 5:10 am

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

Sat Feb 02, 2019 8:00 am

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
supershepp
Posts: 10
Joined: Mon Jan 07, 2019 12:12 am

Sat Feb 02, 2019 10:53 pm

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

Sun Feb 03, 2019 8:49 am

You missed a second ! in that example. Would that be the issue?

i.e. !Lock9bar [1]\r\n !SetLoco9bar [GoToNum9bar.Value]\r
supershepp
Posts: 10
Joined: Mon Jan 07, 2019 12:12 am

Sun Feb 03, 2019 8:42 pm

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