The model consists of a motor controlled barrier with a traffic light and a light sensor.
When you are building the model, follow this order:
- Build the model step by step, if possible do partial tests
- Visual control of all cables before you start testing
- Use the Test Interface to verify all sensors and actors are working. Switch motors/lamps on and off manually and check if the sensors are working by simulating input signals and then checking the output on the Test Interface.
- Break the project down into smaller independent tasks, then code and test each module.
- For the software first start creating two functions, one opening and closing the barrier. First only focus on the barrier movement, then also add the traffic light
- Next put those functions into separate code units (i.e. functions, subroutines) and get the project running without the light sensor.
- Think on how to use the light sensor input and modify the main program. to establish the full functionality.
If you are facing problems, look here …
- Is the motor turning the right direction? You may need to change the polarity, exchanging “+” and “-“.
- Did you connect the switches in the right order? The switch reporting a closed barrier is connected to I2, the other switch reporting an open barrier is connected to input I3.
- Does the cogwheel properly connect to the motor?
The final project