I have been writing a code following a motor moving a platform back to a "home location" using an optical limiter. I would like to use a button on the screen during this movement to be able to cancel the motion if anything goes wrong, but because I don't know how to set a button to interrupt the process, powering the motor is extremely slow due to having to refresh the screen everytime the loop is made (it goes until the optical limiter sees it). I think adding this button to an ISR would work great because then I would only need to power the motor and not have my microcontroller process the screen data and then take another step on the stepper motor I am using. Could someone show me an example of an onscreen button being used as an interrupt? Thanks in advance.
Please sign in to leave a comment.