The global variable c stores at any time the current floor as the variable g stores the goal (the floor that the lift must reach). The motor waits for an order from the control part. This order should be up one floor (c := c+1) or down one floor (c := c-1). The order is represented by the variable a which is updated correctly according to the goal g searched by the control panel. After that, the control program compares the values of c and g until they are equal and finally chooses a new goal floor arbitrarily. The number of floors is parametrized by the parameter N.