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?
Send BLE command of String
Re: Send BLE command of String
Found it:
uint=new Uint8Array(str.length);
for(var i=0,j=str.length;i<j;++i){
uint[i]=str.charCodeAt(i);
}
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 9 guests