What is the order of operations when using a keypad, lcd, motor?

What is the order of operations when you want to use a keypad input value to drive a motor and have information displayed on a display?

In the physical world you punch in a value on the keypad eg. 500 then press "go", and the device will move to that position. The LCD will have to show current position and the desired position, also count up or down in real time as the device moves to the next position.

Having never programmed an arduino to this level I was wanting to know how this is "ordered" in programming.

For example:

Imagine a flow chart of what steps it takes to make the desired move.

Input from keypad. > pulses from arduino to motor driver > motor moves requested pulses.

Where in that does it display all the visual information to the LCD from a programming perspective?

Simple answer is, you choose.

The sketch in an Arduino is run sequentially, so if you want to:

  • Read button
  • Update LCD
  • Set motor speed

.... or ....

  • Read button
  • Set motor speed
  • Update LCD

... that's entirely up to you.

The stuff in setup() gets run once and in the sequence you give. The stuff in loop() runs over and over, but in the sequence you give, each time.

I agree with @JimboZA - however I think he omitted one important concept - the code must be designed to allow loop() to repeat 100s to 1000s of times per second.

If you use the code in planning and implementing a program for experimenting you should find it makes no difference what order the functions are called.