I am wondering how I enter the New Line delimiter from the keyboard on my MacBook Pro (late 2013) under MacOS 10.15.3. I am using
serial.onDataReceived(serial.delimiters(Delimiters.NewLine), function () {
…
})
on a USB-connected micro:bit to receive keyboard input from my computer. I have been successful using all of the available delimiters e.g. Colon, Comma, Dollar, Fullstop and Hash, except for NewLine. I have tried a variety of keystrokes and unicodes, including U+2424 which prints in the Terminal, using the Zsh Screen command, as NL. I can use console.log("\n") function to output New Line; but I have not been successful using the OnDataReceived function to recognize the New Line delimiter as input. Any thoughts?
Many thanks @mmoskal Your suggestion motivated me to go back and try a variety of New Line Unicodes. It appears that, for MacOS, the New Line delimiter is ASCII 10 or U+000A which, as far as I know, can only be entered, on my MacBook Pro, as Unicode Hex input 000A.
0x0A is Line Feed, rather than 0x0D which is Carriage return.
Its common to have LF/CR as a pair, but Unix type systems tend to strip one of them - IIRC the CR is stripped usually.
Dave