That was exactly the issue. I read the sensor module user guide again, it explained the results will end in a "\r". So I removed the checking for the newline character. As soon as I removed the newline check and only checked for a CR:
if (e.data != "\r")
It worked. When I get home from work I will implement your example.
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.
That was exactly the issue. I read the sensor module user guide again, it explained the results will end in a "\r". So I removed the checking for the newline character. As soon as I removed the newline check and only checked for a CR:
It worked. When I get home from work I will implement your example.