I have a bluethooth device (HM10) that receives an 'a' as a test, but I do not know how to send this string as an array buffer.
The device connects, the problem is the sending of this data
This is my code:
`
var service = evothings.ble.getService(app.device, app.SERVICE_UUID);
var characteristic = evothings.ble.getCharacteristic(service, app.CHARACTERISTIC_UUID);
app.display(JSON.stringify(characteristic));
var data = new Uint8Array(1);
data[0] = 'a';
evothings.ble.writeCharacteristic(
app.device,
characteristic,
data, // Buffer view with data to write
function()
{
app.display('characteristic written');
},
function(errorCode)
{
app.display('writeCharacteristic error: ' + errorCode);
});
Hello everybody,
I have a bluethooth device (HM10) that receives an 'a' as a test, but I do not know how to send this string as an array buffer.
The device connects, the problem is the sending of this data
This is my code:
` var service = evothings.ble.getService(app.device, app.SERVICE_UUID); var characteristic = evothings.ble.getCharacteristic(service, app.CHARACTERISTIC_UUID); app.display(JSON.stringify(characteristic));
`
NOTE:
I have also sent:
'a' binary var data = new Uint8Array(8); data[0] = '0'; data[1] = '1'; data[2] = '1'; data[3] = '0'; data[4] = '0'; data[5] = '0'; data[6] = '0'; data[7] = '1';
'a' Hexa var data = new Uint8Array(2); data[0] = '6'; data[1] = '1';