Send BLE command of String

Ask, and ye shall receive.
avip
Posts: 12
Joined: 17:48, 06 Apr 2015

Send BLE command of String

Postby avip » 16:44, 29 May 2015

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?

avip
Posts: 12
Joined: 17:48, 06 Apr 2015

Re: Send BLE command of String

Postby avip » 16:56, 29 May 2015

Found it:
uint=new Uint8Array(str.length);
for(var i=0,j=str.length;i<j;++i){
uint[i]=str.charCodeAt(i);
}


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 8 guests