Warning: The RPI-LED Light Show Application flashes LEDs ON and OFF. Anyone who is sensitive to flashing lights in any way should not view or operate the RPI-LED board Light Show Application. Use at your own risk.
The RPI-LED Light Show Source Code provides a GPIO read/write example using the newer GPIO character device driver, present on many Linux distributions. Character device drivers are available on many single board computers including the Raspberry Pi within the last few years. More example code will be made available when the new Embedded Web Control Panels on the Raspberry Pi: Design Reference technical book is released (ISBN: 978-0-9970222-7-8).
There are two great reasons to program GPIO pins using a character device driver:
LIGHT SHOW SOURCE CODE DIRECTIONS:
1. Make sure your Raspbian/Raspberry Pi OS is updated to a recent version within the last year to make sure character device driver support is available.
2. Download the RPI-LED Light Show Source Code: rpi-led.tgz
3. Save the rpi-led.tgz file to the user directory. example: /home/pi/
4. Extract the source file and readme by typing the following command from the terminal while in the user directory:
tar -xzvf rpi-led.tgz
The files should extract into a rpi-led sub-directory.
5. Change into the rpi-led sub-directory: cd rpi-led
6. Build the rpi-led source code:
gcc rpi-led.c -o rpi-led -Wall
Note: If your OS is not updated to a recent version with character device driver support then the build may fail or may not find the gpio.h header file.
7. Make sure the output file is executable:
chmod +x rpi-led
8. Run the RPI-LED light show application: ./rpi-led
9. Press CTRL-C or connect CTRL2 on the board to ground to exit the application, when desired.
The RPI-LED Board has two inputs for control using switches; CTRL 1 and CTRL 2. By connecting a switch from CTRL 1 to ground (GND); when the switch is on the light sequencing will halt. When the switch is turned off the internal pull-up will pull the line high allowing the light show to continue.
The CTRL 2 input is used to exit the application by turning on a switch connected between CTRL2 and Ground (GND). Each switch input is checked at the end of each LED pattern. See the RPI-LED datasheet for more details about the control inputs on the board.
Download light show 'C' source code for the Raspberry Pi
Copyright © 2019 - 2023
Microsystem Technologies.
All Rights Reserved.