This race that lasts a thousand years
Will soon be done.
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!