I am making a Raspberry Pi librarian which can keep track of available books and who has taken out a book. Users scan NFC cards to begin the process of borrowing a book.
The main program is an infinite loop and goes like this:
while True: # wait for card to be scanned # identify the user from a database # ask if borrowing or returning # ask which book user wants to borrow/return # update the database
I want to be able to include a physical cancel button so that the user can cancel at any time in the borrowing/returning process and the main loop will restart and wait for a card again.
I've used this guide from Raspi.TV and successfully set up an interrupt button.
How would I code this into my program?