A direct cross terminal, which is easily accomplished with the Serialx.on with a write to the oppositng port. I could also put them to a loopback too, I suppose. Right now I've got the xterminal going with USB as my kind of watch port.
What you're suggesting, which is pretty great actually.
A little more autonomous functionality that I could call a send so that higher level functions could be implemented for bigger things such as socket dials.
Having trouble with #3 right now. Any particular reason this wouldn't work? Right now it's like if I sent anything to the port I can't loop and read or check availability from that port in waiting, it needs to come back to the terminal or I need to utilize setTimeout.
function Test(inSTR, timeOut) {
var TO=getTime() + timeOut; //set timeout in seconds
Serial6.println(inSTR);
while (getTime() < TO) {
if (Serial6.available() > 0) {
console.log("Success.");
return 1;
}
}
return -1;
}
So Test('AT+CREG?',2) simply comes back with a timeout in this case.
This is probably something silly that I'm not taking into account.
I've tried implementing other options such as using a Serial6.on to just parse and put to a buffer, but I'm having trouble with what appears to be scoping (my JS is awful, kind of learning as I go).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yeah I'd like to have a few options.
Having trouble with #3 right now. Any particular reason this wouldn't work? Right now it's like if I sent anything to the port I can't loop and read or check availability from that port in waiting, it needs to come back to the terminal or I need to utilize setTimeout.
So Test('AT+CREG?',2) simply comes back with a timeout in this case.
This is probably something silly that I'm not taking into account.
I've tried implementing other options such as using a Serial6.on to just parse and put to a buffer, but I'm having trouble with what appears to be scoping (my JS is awful, kind of learning as I go).