Thank you. I will fix it.
Just one more thing...
More advanced users could leave out byte to int conversion in node.js code:
if you change:
fs.appendFile('mydata.txt', msg.readUInt16LE(0) + crlf, encoding='utf8');//write the value to file and add CRLF for line break
into:
fs.appendFile('mydata.txt', msg, encoding='utf8');
You will be saving bytes in ascii characters and logging file will be much smaller...
One of my next projects will be to use arduino as an oscilloscope to send a lot of data quickly over UDP to browser.
In that case udp packets will be 512 bytes long instead of 2 bytes as in this example.