I've attached the exact code I used and below is the console output.
idx 4 buf 1000 line 4 idx 109 buf 1000 line 109 idx 2 buf 1000 line 2 idx 109 buf 1000 line 109 idx 2 buf 1000 line 2 idx 109 buf 1000 line 109 idx 4 buf 1000 line 4 idx 111 buf 1000 line 111 idx 4 buf 1000 line 4 idx 110 buf 1000 line 110 idx 4 buf 1000 line 4 idx 110 buf 1000 line 110 idx 2 buf 1000 line 2 idx 110 buf 1000 line 110 idx 4 buf 1000 line 4 idx 110 buf 1000 line 110 idx 5 buf 1000 line 5 idx 110 buf 1000 line 110 idx 4 buf 1000 line 4 idx 110 buf 1000 line 110 idx 4 buf 1000 line 4 idx 109 buf 1000 line 109 idx 3 buf 1000 line 3 idx 110 buf 1000 line 110 idx 2 buf 1000 line 2
With the attached code "line" is only 4 bits in length;
JSON.stringify(line) "new Uint8Array([37,0,37,32])"
Using the original working code I managed to get a complete frame of data in line which I've pasted below.
>USB.print(JSON.stringify(line)); "?\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f\f\x00\f\x0F\x00\x0F\x13\x00\x13\x17\x00\x17\x1B\x00\x1B \x00 $\x00$*\x00*/\x00/4\x0049\x009?\x00?D\x00DD\x00D?\x00??\x00?D\x00DD\x00D?\x00?9\x0094\x004/\x00/*\x00*$\x00$ \x00 \x1B\x00\x1B\x17\x00\x17\x13\x00\x13\x0F\x00\x0F\f\x00\f"=undefined >
@Owen started
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.
I've attached the exact code I used and below is the console output.
With the attached code "line" is only 4 bits in length;
Using the original working code I managed to get a complete frame of data in line which I've pasted below.