It'll stop working when USB is unplugged, and you just need to add USB.setConsole(1) to onInit to fix that (by forcing the JS console to stay on USB even if USB is unplugged).
So you have an oscilloscope or any way to debug this? It is possible that the delay of JS execution is longer than the time we allow in the digitalPulse.
You could try digitalPulse(TX_ENABLE_PIN,1, 2+(data.length*10/19200)); instead?
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.
Serial1 should work fine with USB plugged in.
It'll stop working when USB is unplugged, and you just need to add
USB.setConsole(1)
to onInit to fix that (by forcing the JS console to stay on USB even if USB is unplugged).So you have an oscilloscope or any way to debug this? It is possible that the delay of JS execution is longer than the time we allow in the
digitalPulse
.You could try
digitalPulse(TX_ENABLE_PIN,1, 2+(data.length*10/19200));
instead?