- Fri Nov 18, 2016 9:50 am
#58311
So you wish to send local serial commands via wifi to manage remote serially controlled devices, therefore no browser gui involved anywhere, right?.
There are many ways of skinning the same cat - but one way is to have your local ESP connected to your local computer Serial terminal via usb com port, so you can have your ESP branch when receiving serial info...
SERIALBRANCH:
Defines a branch to be executed when serial input is received.
serialbranch [branchLabel]
Example
serialbranch [serialin]
wait
[serialin]
serialinput zz$
Serialprint “received:”
serialprintln zz$
return
Trim off the end linefeed character then udp broadcast the received data using...
Udpwrite:
Write a string toward a remote IP and port
udpwrite {ip_address}, {port}, {message}
ip_address is a string (ex: “192.168.1.123”)
message is a string (ex: “This is a valid message”)
port is a number (ex: 5000)
Example: udpwrite “192.168.1.12”, 3000, “Message OK”
Obviously for 2 way coms you would need to do the same serial to udp broadcast on both local and remote devices.
Ditto for the udp to serial side of things, which would be done with...
UdpBranch:
Define a branch label defining the place where the program will continue as soon as an UDP message is received. As soon as the return command is found, the program will continue from the interrupted point.
To works, the UDP server needs to be open (commands UdpBegin or udpBeginMultiCast)
udpBranch {label}
Example:
udpbegin 4567
udpbranch [udp.received]
wait
[udp.received]
let rec = udpread()
let rem = udpremote()
Serialprint “Message received “ & rec & “ from “ & rem
udpreply “OK”
return
I've only copied the relevent examples directly from the documentation, so you'll obviously need to massage things to suit, but if I've picked up on your question correctly, that should give you all the basic mechanisms you will need.