You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just moved this to the interfacing forum as I think it makes sense in there.

    But I think you should be fine - connect to the MDBT42Q via Bluetooth (it only has one UART), then do something like:

    Bluetooth.setConsole(1); // force console to Bluetooth so it doesn't interfere when we disconnect
    Serial1.setup(9600,{rx:D14}); // or any pin at all
    var data = "";
    Serial1.on('data', function(d) {
      data += d;
      var match = data.match(/[\x02\x03]....[^\x03]*\x03/)­;
      if (match) {
        console.log(match[0]);
        data = data.substr(match.index+match[0].length)­;
      }
    });
    

    That should print out any 6+ byte packet that begins with 2 or 3 and ends with 3 - but it's entirely possible that it might get confused by a packet that contains the byte 3 in the payload, so you may have to be a bit more clever - for instance by detecting pauses in the serial transmission.

    Once you have the packet itself though you can use str.charCodeAt(x) to get the actual character data you need, or can even do E.toUint8Array(str) to get it as an array that you can access normally.

About

Avatar for Gordon @Gordon started