Building a Traffic Light System in Julia Programming Language

Posted in category Software on
405 Words ~3 Minute Reading Time • Subscribe to receive updates on Software
Eric David Smith
Software Engineer / Musician / Entrepreneur
Building a Traffic Light System in Julia Programming Language by Eric David Smith
Click image to view on GitHub

Traffic Lights - Julia Programming Language

A simple traffic light simulator written in the Julia programming language. The program will output the current light color and how long it will stay that color. The program will continue to cycle through the lights until the program is stopped.


I've been learning Julia and this seemed like a fun project to create.

Julia Highlights


Julia was designed from the beginning for high performance. Julia programs compile to efficient native code for multiple platforms via LLVM.


Julia is dynamically typed, feels like a scripting language, and has good support for interactive use.


Reproducible environments make it possible to recreate the same Julia environment every time, across platforms, with pre-built binaries.


Julia uses multiple dispatch as a paradigm, making it easy to express many object-oriented and functional programming patterns. The talk on the Unreasonable Effectiveness of Multiple Dispatch explains why it works so well.


Julia provides asynchronous I/O, metaprogramming, debugging, logging, profiling, a package manager, and more. One can build entire Applications and Microservices in Julia.

Open source

Julia is an open source project with over 1,000 contributors. It is made available under the MIT license. The source code is available on GitHub.


Instal Julia

brew install --cask julia


Download and install from


julia src/main.jl

Example Output

Below is a sample output of the program.

➜  julia_playground julia src/main.jl
Cycle 1: Light is Red for 55 seconds
Cycle 2: Light is Green for 60 seconds
Cycle 3: Light is Yellow for 5 seconds
Cycle 4: Light is Red for 55 seconds


julia test/runtests.jl


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


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
Software Engineer / Musician / Entrepreneur

Related Blog Posts

Scroll →

Blog Post Tags