Page 1 of 1

Send BLE command of String

Posted: 16:44, 29 May 2015
by avip
The current method in the examples shows:
app.device && app.device.writeDataArray(new Uint8Array([111,110,49]));

How can I send a String instead of an array of bytes?

Re: Send BLE command of String

Posted: 16:56, 29 May 2015
by avip
Found it:
uint=new Uint8Array(str.length);
for(var i=0,j=str.length;i<j;++i){
uint[i]=str.charCodeAt(i);
}