Let's say a microcontroller is connected to two green lights, two red lights, two motors, six switch buttons and a sensor

Light_One_RED
Light_Two_RED

Light_One_GREEN
Light_Two_GREEN

Motor_One
Motor_Two

Motor_One_Start Button
Motor_Two_Start Button
Motor_One_Stop_Button
Motor_Two_Stop_Button

Reset_Button
Pass_Button

Object_Sensor

In the beginning, light one red and light two red both remain on while light one green and light two green both remain off. Also both motors stay off.

If the sensor detects an object, the light one
RED should be turn OFF while the light one Green should be turn On.

Motor one does not turn on until the sensor detects the object

If the sensor is faulty or not working, the motor one can also be start / stop manually by pressing Motor_One_Start Button and Motor_One_Stop_Button


Motor one can be controlled via button or controlled via sensor, I don't understand the how sequence will work to control motor one in the system?