Hi. Yes, what you're doing is right - However because the 'console' (the interactive command-line) is on USB, the callback is disabled.
Try moving the console out of the way with Serial1.setConsole(), and it should work. You'll then have to reset the board before you can program it again though (unless you program it via Serial1).
However you're doing the print, which will then appear on Serial1 (pins A9/A10). If you wanted to echo the data back down USB then you could do: USB.write("<USB> "+data+"\r\n").
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.
Hi. Yes, what you're doing is right - However because the 'console' (the interactive command-line) is on USB, the callback is disabled.
Try moving the console out of the way with
Serial1.setConsole()
, and it should work. You'll then have to reset the board before you can program it again though (unless you program it via Serial1).However you're doing the
print
, which will then appear on Serial1 (pins A9/A10). If you wanted to echo the data back down USB then you could do:USB.write("<USB> "+data+"\r\n")
.Hope that helps!