Working interrupt-based Bluetooth code