You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • Happy New Year to you too, Eric!

    I assume that your anonymous function in s(erial).on("data",function(d){...}) is not complete yet (because String.charCodeAt(index) needs an index into the string to indicate from which char you want the code (ascii value). For the interpretation of the complete response, you can go directly after each character's code in the response string ( switch response.charAt(1) { ... case 0x0C: ... }; and do not have to go through the buffer of numbers business...

    Composing the response though may change too, because data received my contain (parts) of more than one response (I do not know if this is possible with your device, but even then, when responses back up / congest for what ever reason, you will get there). Extract response one by one from composed received data and interpret only the extracted one.

    Checkout the gps module. It does this, because it receives multiple sentences and each has to be interpreted standalone.

About

Avatar for allObjects @allObjects started