CODESYS example: TrafficLight-Webvisu
This tutorial demonstrates how to create a simple web visualization of traffic lights on a RevPi using CODESYS WebVisu.
Prerequisites
Hardware
✓ RevPi Connect+ as base module (you can use a RevPi Core or a RevPi Compact instead)
✓ RevPi DIO as expansion module
For detailed instructions about how to set up your system, see Getting Started.
Software Requirements
✓ CODESYS Development System is installed on your PC
To ensure a compatible system with suitable software, see CODESYS System Requirements.
Overview
The application simulates a traffic light system with the following modes:
-
Normal Mode:
- Red and green lights are active for 10 seconds each.
- Yellow light acts as a transition for 2 seconds.
-
Night Mode:
- Only the yellow light flashes in this mode.
The following figure provides an overview of the CODESYS device tree for the setup:
Adapting for RevPi Core or Compact
To adapt the project for RevPi Core or RevPi Compact:
▷ Right-click on RevPi Connect in the CODESYS device tree.
▷ Select Update device.
▷ Choose RevPi Core or RevPi Compact as the replacement and rename the device accordingly.
Deploy and Test the Application
-
Compile and Download:
▷ Ensure there are no errors in your program.
▷ Download the application to the RevPi Connect.
-
Access the Web Visualization:
▷ Open a browser and navigate to your RevPi Connect’s web server:
http://<RevPi-IP-Address>:8080/webvisu.htm
Example:
http://192.168.168.159:8080/webvisu.htm
.
Adapting for RevPi Core or Compact
-
Test the Traffic Light:
▷ Verify normal mode operation with the specified durations.
▷ Toggle the night mode switch and observe the yellow light flashing.
Additional Notes
- Ensure your RevPi Connect and DIO modules are properly connected and configured in the CODESYS device tree.
- The visualization design can be customized to include additional controls or indicators as needed.