I've got to make an odometer for an airplane for a school comp.
I'm having trouble getting a good structure down.
I'm using a magnetic sensor to count rotations on a wheel, no problem there.
Basically it has to show the calibration #, measure takeoff then using a switch be able to shut off the takeoff counter and switch to a landing counter when the switch is repressed, then has to display landing and takeoff.
I have it set up right now using the sensor, a takeoff/landing switch, a user button, external reset button, and a 2x16 serial display.
i have the basic flow of the loop as
if user button=0
show a splash screen
if user button=1
show calibration #
if user button=2
show press to start
if user button=3
start takeoff/landing function
if user button=4
show distance counters
what I'm having a problem with is ending the takeoff/landing function.
i want to be able to use the same user button to switch to the next function but don't want it polling that button in a while function, I could use an interrupt but that would entail another button.
Would i be able to make the user button an interrupt and have it call an increment function therefore interrupting the takeoff/landing function and passing it to the next show function?
Is there a better way i can structure my code to make it flow better?