Like I said, I am not an Arduino expert.
But your description mentioned HM-10, so I'll throw in this FAQ for you:
It would be helpful for you to include a circuit diagram for the hardware people on this board.
I'll tag a few of them, in case any are awake and onlike.
@uskiara
They are in Europe.
P.S. It would also be helpful to know if your device hardware is BLE or plain Bluetooth.
That makes a difference on the AI2 side.