Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - dyay108

Pages: [1]
1
Android / Cannot write to lilypad simblee with my android app
« on: April 21, 2016, 06:54:16 AM »
this is the code i'm using to write to the characteristic, but setValue returns false.

Code: [Select]
public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            Log.w(TAG, "BluetoothAdapter not initialized");
            return false;
        }
        characteristic.setValue(new byte[]{0x02});
        Log.i(TAG, "characteristic " + characteristic.getUuid().toString());
        //Log.i(TAG, "characteristic " + mBluetoothGatt.getServices().get(2).getCharacteristics().get(1).getPermissions());
        boolean status = mBluetoothGatt.writeCharacteristic(mBluetoothGatt.getServices().get(2).getCharacteristics().get(1));
        return status;

    }

code on lilypad:

Code: [Select]
void SimbleeBLE_onReceive(char *data, int len){
    int i = ht.length()+1;
    char hang[i];
    ht.toCharArray(hang,i);
    SimbleeBLE.send(hang,i);
    }

Pages: [1]
anything