Interrupt Button and Bluetooth

It is a common task in watchX projects to use an interrupt button to wake up the application. Libraries as PinChangeInterrupt.h or EnableInterrupt.h are making this possible. But as soon as bluetooth library Adafruit_BLE.h is included this leads to an error. The troubleshooter is the underlaying SoftwareSerial.h .

There is a way to avoid this and to use an interrupt button and bluetooth in the same sketch. You have to modify the Adafruit_BluefruitLE_UART.h, which is in the adafruit_bluefruitle_nrf51folder inside the Arduino library folder.

Just comment out the line “ #define SOFTWARE_SERIAL_AVAILABLE … “ in Adafruit_BluefruitLE_UART.h library:

library

After the modification you can try this example:

The BLE_Interrupt_Example.ino triggers audio volume of a connected smartphone. And there is an interrupt button to wake up the application or send it to sleep. In the root of the GitHub repository you can find the modified Adafruit_BluefruitLE_UART.h .

Always be aware that updates of the Arduino library may overwrite the modified Adafruit_BluefruitLE_UART.h or perhaps other sketches will need the unmodified (original) version.

3 Likes

Thank you for this excellent post!