-
• #2
You should be able to shift the Espruino console over with:
var server = net.createServer(function(c) { console.log('server connected'); c.write('Your welcome message!\r\n'); LoopbackA.setConsole(); LoopbackB.pipe(c); c.pipe(LoopbackB); }).listen(23);
You won't be able to Ctrl-C out of loops and things though, since the Wireless is handled with the same priority as normal JS code.
With multiple servers, I'm afraid that while Espruino doesn't have a problem with it, the ESP8266 module can't handle it (at least using the current ESP8266 AT firmware - I'm sure they could change it in the future).
-
• #4
That works both ways, you could always do something like is on: http://www.espruino.com/WiFi+Remote+Console
It's a lot less flexible, but in a way is easier because you're sending one thing to evaluate in one request
I've been running an ESP8266 on a Pico to control a servo (venetian blind tilt), using HTTP. However, I'm switching to a TCP socket instead to control via
nc
, so that I can do immediate variable control from a remote rotary encoder rather than the slow open-request-response-close HTTP method.That seems to be working, but I was wondering if it was possible to effectively do
socket.setConsole();
I know it's not that straightforward, as it would be if it were acting as a serial port, but is there some way of passing incoming data fromsocket.on('data', function () { /* pass to console */ })
? It'd be nice to just sendservo.set(...)
commands vianc
rather than making up a new protocol.Incidentally, I was having trouble running the HTTP server and the TCP socket server running at the same time, even though from what I can see
AT+CIPMUX=1
is set. Code:Error is:
If either the
http
pair or thessock
pair are commented, no problem. Before I spend too much time fiddling, has anyone managed to do two separate servers at the same time, or is this a known limitation?Thanks, as ever :)