This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use BLE UART interrupt to jump out of a loop

I am trying to figure out how to exit a loop of my program using a button press on the nRF Toolbox UART app. Say it's button 4 for sake of giving it a value. I am using an Adafruit Feather 32u4 BLE microcontroller. I can start the motor from the app by pressing button 1 which sends a 1 value to the microcontroller. I can't leave the motor loop though unless I tell it how many times to loop. The loop is running the stepper motor clockwise and counter-clockwise and will need to be stopped at random times to explain what the motor is turning during a presentation. Waiting for the motor to stop will hamper the presentation. This is probably a simple question, so I apologize for my lack of knowledge on using interrupts. Any help would be great.

Related