1

I'm trying to connect through serial Scratchx and a piece of hardware similar to Arduino.

Scratchx lets you send data in JS this way:

var pingCmd = new Uint8Array(1);
pingCmd[0] = 1;
device.send(pingCmd.buffer);

Problem is the hardware firmware expects a string terminated with a carriage return, not an array buffer.

Can you imagine a way to send this carriage return? I'm giving up, but... any idea is appreciated.

  • Inserting \n at the of string then convert it to Uint8Array ? – Vinay Jan 10 '17 at 18:17
  • I did it before posting but with no luck. I found hald a solution meantime but it's unrelated to the question –  Jan 11 '17 at 11:48
  • 1
    Well, if the requirement really is a _carriage return_, then I'd suggest to try `\r` or `\r\n` rather than `\n`. – Ruud Helderman Oct 19 '17 at 11:22

0 Answers0