Serial Server from url question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
houk008
New user
Posts: 6
Joined: 24 May 2017, 16:21

Serial Server from url question

#1 Post by houk008 » 31 Oct 2023, 20:07

Hello everyone
I have one question, how to pass to serial enter character from url?
I have serial server that passing commands to little device controling leds
and this device need enter after each command
when serial server used from socat its working fine but when tried to switch to url, not working
http://ip/control?cmd=serialsend,rgb,10 ... ,100%0D%0A as you can see %0D%0A and also only one of them and no effect. Maybe you have idea how to do it. I search google and nothing worked

when i use socat
rgb,0,60,100,4,100
rgb,100,60,0,4,100
when i use url
rgb,100,60,100,4,100rgb,100,60,100,4,100rgb,100,60,100,4,100rgb,100,60,100,4,100rgb,100,60,100,4,100
on serial monitor

TD-er
Core team member
Posts: 8757
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Serial Server from url question

#2 Post by TD-er » 31 Oct 2023, 20:13

Have you also tried "\n" (without the quotes)?
or %CR% or %N% ?

houk008
New user
Posts: 6
Joined: 24 May 2017, 16:21

Re: Serial Server from url question

#3 Post by houk008 » 31 Oct 2023, 20:28

yes \n\r was tested before just passing this characters to serial :D
rgb,100,60,100,4,100\n\r

%CR% gives rgb,100,60,100,4,100♀%
%N% gives rgb,100,60,100,4,100rgb,100,60,100,4,100rgb,100,60,100,4,100

User avatar
Ath
Normal user
Posts: 3526
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Serial Server from url question

#4 Post by Ath » 31 Oct 2023, 21:09

You can use the "serialsendmix" command, that allows interspersing the (text)data to send with hexadecimal values (including 0x00 if desired). Documentation for that command is not published yet, though the command is currently available, but still in an open pull request and can be read here from the source. (deciphered maybe :lol:)

In short, your command should then look like this:

Code: Select all

serialsendmix,rgb,0,60,100,4,100,0x0a,rgb,100,60,0,4,100,0x0a
The difference here is that for the serialsendmix command, any content item (separated by commas) that starts with 0x is interpreted as the hexadecimal value for a character, or sequence of characters. These can be appended in multiples of 2 characters, as explained in the link above, and separators can also be used.

You can prefix that command, like all commands, with the regular url syntax "http://ip/control?cmd=".
/Ton (PayPal.me)

houk008
New user
Posts: 6
Joined: 24 May 2017, 16:21

Re: Serial Server from url question

#5 Post by houk008 » 31 Oct 2023, 23:36

Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests