Skip to content

qnx/Workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QNX Workshop - Traffic Lights

This project enables basic operation of two Traffic Light modules with a Raspberry Pi running QNX. It includes samples in both Python and C that do exactly the same thing. It assumes you are working on the QNX Developer Desktop, or a similar self-hosted target.

See the Project Slides PDF in the root of this repo for more information. If you're attending a QNX workshop in person, these slides match what the presenter is showing in-person.

Features

  • Traffic lights illuminate and the sets alternate quickly, in the style of a simulated intersection
  • Stopping the program (SIGINT) shuts off all LEDs

Instructions

  1. On your QNX target, make a working folder (ex. pihardware) and clone this repo into it (resulting in pihardware/traffic-lights):
    git clone https://github.com/qnx/workshop
  2. In the same working folder, clone the Raspberry Pi Hardware Component Samples repo that contains many Raspberry Pi hardware samples and some common libraries (resulting in pihardware/Raspberry-Pi-Hardware-Component-Samples)
    git clone https://github.com/qnx/Raspberry-Pi-Hardware-Component-Samples
  3. Assemble the hardware per the Circuit Diagram below
  4. For Python, navigate to the python/ directory from this repo and run python traffic-lights.py
  5. For C, navigate to the c/ directory from this repo and run make all to build the project. To run the sample, look for the binary in the build/ directory (./build/aarch64le-debug/traffic-lights).

Circuit Diagram

The GPIO pins used in the sample were chosen specifically to be adjacent pins, for easier connections. For a diagram of Raspberry Pi GPIO numbers, see: https://pinout.xyz/

If you choose to customize the GPIO pins you use, make sure to update the code with the matching GPIO pins.

Traffic Light - First Module

  • GND is connected to the GND pin of the Raspberry Pi.
  • R is connected to GPIO 16 of the Raspberry Pi.
  • Y is connected to GPIO 20 of the Raspberry Pi.
  • G is connected to GPIO 21 of the Raspberry Pi.

Traffic Light - Second Module

  • GND is connected to the **GND pin of the Raspberry Pi (bottom corner).
  • R is connected to GPIO 26 of the Raspberry Pi.
  • Y is connected to GPIO 19 of the Raspberry Pi.
  • G is connected to GPIO 13 of the Raspberry Pi.

About

The content of this repo is used in hands-on QNX learning workshops.

Topics

Resources

Stars

Watchers

Forks

Contributors