Ok I think I know what the issue is basically the write method has an issue with passing it functions. Feel free to look at the screenshot or logs below.
When I pass LoopbackA.write("Hello"); , Hello is transmitted across ws.
When I pass LoopbackB.write(digitalWrite(D5,1)); The LED is turned on, but the error below is given.
When I pass LoopbackB.write(digitalWrite(D5,0)); The LED is turned off, but the error below is given.
When I pass console.log("test"); test prints out to the ESPRUINO IDE but is not transmitted and the same error is given.
I also tried directly passing console.log("test"); into LoopbackB but got the same error.
Check out the attached screenshot, it's much easier to see.
Console from ESPRUINO WEB IDE
>LoopbackA.write("Hello");
=undefined
>LoopbackA.write(digitalWrite(D5,1));
Uncaught TypeError: Expecting a number or something iterable, got undefined
at line 1 col 35
LoopbackA.write(digitalWrite(D5,1));
^
>
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.
Ok I think I know what the issue is basically the
write
method has an issue with passing it functions. Feel free to look at the screenshot or logs below.When I pass
LoopbackA.write("Hello");
,Hello
is transmitted across ws.When I pass
LoopbackB.write(digitalWrite(D5,1));
The LED is turned on, but the error below is given.When I pass
LoopbackB.write(digitalWrite(D5,0));
The LED is turned off, but the error below is given.When I pass
console.log("test");
test prints out to the ESPRUINO IDE but is not transmitted and the same error is given.I also tried directly passing
console.log("test");
intoLoopbackB
but got the same error.Check out the attached screenshot, it's much easier to see.
Console from ESPRUINO WEB IDE
CONSOLE FROM MY WEB APP
1 Attachment