This is the code I used for my project, but you can also access it through the “Adafruit_BluefruitLE_nRF51” library. I’ve explained how to add this library to Arduino in my workflow. Copy and paste it into Arduino if you don't want to download the Bluetooth library.