Building a Traffic Light System in Ada Programming Language

← Go Back Software
330 Words • ~2 Minute Reading Time
Building a Traffic Light System in Ada Programming Language by Eric David Smith
Click image to view on GitHub

In this tutorial, we are going to implement a simple traffic light system using Ada, a statically-typed, high-level programming language designed for the development of very large software systems.

Prerequisites


Before we get started, you need to have the GNAT Ada compiler installed on your system. If you don't already have it, you can download and install GNAT from the official AdaCore website. Follow this link to download.

Compilation


Once you've got the GNAT Ada compiler installed, you're ready to compile the Ada source code into an executable.

First, navigate to the root directory of the project using your terminal:

cd ada-traffic-light-system

Next, compile the Ada source code into an executable with this command:

gnatmake -D obj -o obj/main src/main.adb

This will create the executable file in the obj directory.

Execution


Finally, you're ready to run the traffic light system! Follow these steps:

First, navigate into the obj directory:

cd obj

Then, run the program:

./main

The traffic light system will start and display the different light colors, like this:

➜ ./obj/main
Green light
Yellow light
Red light
Green light
Yellow light
Red light
Green light
Yellow light
Red light
Green light
Yellow light

That's It!


You've just built a simple traffic light system in the Ada Programming Language. Congratulations!

License


This project is licensed under the MIT License - see the LICENSE file for details.

Contributing


If you find this useful as is please let me know. If you find any bugs, please feel free to submit a pull request or open an issue. If you have any questions, you can contact me.

Supporting My Work


Please consider Buying Me A Coffee. I work hard to bring you my best content and any support would be greatly appreciated. Thank you for your support!


Eric David Smith
Father / Software Engineer / Musician / Entrepreneur

Discover More (16) Software


Blog Tags