Categories

It’s a kind of magic

This race that lasts a thousand years
Will soon be done.

Hello World!

Yesterday and today, I kept on working with my nRF51822. On Wednesday, I had managed to do some advertising. Now I wanted to add a custom service.

First, I found a very useful and detailed PDF in the nRF51822 documentation, explaining how to build a simple LedButton service. Another device can write a characteristic to switch on or off the led, and the board notifies the other device when the button is pressed. Quite simple it looks! However this basic service requires a lot of code to work. So today I finished a first complete version, which has the good property to be compilable!!

But the hardest part was to actually test the program. I needed another BLE device to display the list of the services, and to read or write some characteristics. Unfortunately, I couldn’t make the Bluetooth dongle work on Linux (I tried everything Yann explained later in his post, but without success). I also tried to use a BLE scanner app on Lauriane’s Nexus 4, but the behaviour was a little unpredictable (it’s a kind of magic…): for example, I had to restart the phone in order to refresh the service list… Then I tried my program with a Nexus 5 (thanks Thomas!). Unfortunately, the behavior was also kind of magic: this time, I managed to get a notification from the board, but it happens once out of ten tries. So tomorrow I will try with another device, perhaps a Windows computer with the Nordic debug software installed on it (yeah I’m hopeless…).

May the force be with you!

Twitter LinkedIn 

2 comments to It’s a kind of magic

  • Have you tried nRF Master Control Panel on Android?

  • allegrem

    Yes this is the app I used on the Nexus 5. This is the one that worked the best (I managed to get a notification with it), however there are often “Gatt Error” and I don’t know yet if it comes from my program or the Android BLE stack. That’s why I would like to try with another device.