how to start and stop a sequence and remember the last number of the previous

im pretty noob in arduino and i have this assignment where i have to change between two sequence of numbers that are displayed in a 7 segments, at the begining it should display a 0 until i press a push button, then the first sequence should start, then with the push of another button the sequence change into another one and so on, now, the thing is, when i push the button to get back to the previous sequence, it should display the last number the sequence had before changing, also, if i push thr first button again the sequence should stop and display the curent number until i press it again and resume.

so far i have only managed to switch between the sequences and start the code with a 0, and i dont know how to start/stop or how to remember the last number so any help eould be apreciated

pd: sorry for bad english, not my first language

taller2.ino (1.4 KB)

In C, remembering is done with variables. So you declare some:

int lastNumber, thisNumber;

and then in the code you "remember" like this:

lastNumber = thisNumber;

later, you can reference lastNumber in any calculations or conditions.

except that im not using actual numbers, im using binary codes to send to the 7447

First, read about comparison operators.