This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Send data to android from ble(nrf51822)?

I want to send data to my android phone from Nrf51822.My compiler is mbed I use redbearlab NRF51822 kit.For example,I want to see on my phone "hello world". Mbed Program example,

void onDataWritten(const GattCharacteristicWriteCBParams *params)
{
 DEBUG("hello world");
or
 printf("hello world");
     
 } 

 //Android studio side example,
 public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
            super.onCharacteristicChanged(gatt, characteristic);
            writeLine("Alinan Deger " + characteristic.getStringValue(0));


  }

This is the part where I experience the problem? Can anyone tell me what is the problem with this part?

Parents
  • pc.printf("%i, %i, %i\n", (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]); I can get data from nrf51822 to my phone.But I can't write it on my phone I am currently use this code above.How can I make android to get this line and convert it for its self and give me data which I want. As you can understand my problem on the android side? writeLine("Alinan Deger " + characteristic.getStringValue(0)) How can I use this android code and read data? Basicly I want to see accelerometer data on my phone which get by bluetooth.

Reply
  • pc.printf("%i, %i, %i\n", (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]); I can get data from nrf51822 to my phone.But I can't write it on my phone I am currently use this code above.How can I make android to get this line and convert it for its self and give me data which I want. As you can understand my problem on the android side? writeLine("Alinan Deger " + characteristic.getStringValue(0)) How can I use this android code and read data? Basicly I want to see accelerometer data on my phone which get by bluetooth.

Children
No Data
Related