Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can not send data with writeCharacteristics #149

Open
ltobiomynuvola opened this issue Dec 4, 2017 · 0 comments
Open

I can not send data with writeCharacteristics #149

ltobiomynuvola opened this issue Dec 4, 2017 · 0 comments

Comments

@ltobiomynuvola
Copy link

ltobiomynuvola commented Dec 4, 2017

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));

    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);
    });

`

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';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant