Created: 05.10.2016 01:49 Last Modified: 05.10.2016 01:52
Keywords: Git, HAT, Linux, RabbitMax Flex, C, Python, RabbitMax, Raspberry Pi
Blinking RGB LED on Raspberry Pi with RabbitMax Flex
This tutorial explains how to use the RGB LED on RabbitMax Flex Raspberry Pi HAT. This is probably the easiest way to control RGB LED on Raspberry Pi because no soldering is required and there is even no wiring needed. The RGB LED is built in on RabbitMax Flex Raspberry Pi HAT. The HAT also has a relay, a button, a piezo buzzer, an infrared receiver and an infrared transmitter. The best feature is that you can attach up to 5 sensors and a character LCD display module.
Getting started is very easy. You can assemble RabbitMax Flex to your Raspberry Pi with your bare hands. For this particular demo there is no need to attach any sensors or the LCD display module.
Open source examples are available in GitHub. Open a terminal on your Raspberry Pi or login remotely via SSH and type the following command to get the source code:
There are two examples for controlling the RGB LED. The first one is written in the C programming language. Type make to build it and after that run it with sudo:
The RGB LED on RabbitMax Flex will start blinking. Every second you will see a different color: red, green or blue. There is an eternal loop therefore you need to press Ctrl + C to terminate the application.
If you prefer Python as a programming language the second example is for your. It still has absolutely the same behavior as the C example. Execute the following commands to run it:
sudo python rgb-led.py
Just like in the previous example the RGB LED will start blinking in red, green and blue. Again you have to press Ctrl + C to terminate the execute of the Python script.
Getting started is super easy. You can assemble RabbitMax Flex to your Raspberry Pi with your bare hands. After that you can mount up to 5 I2C sensors and the LCD display module. Adjust the brightness of the back light of the LCD display module through the potentiometer using a screwdriver. Visit rabbitmax.com and explore the user's manual for details.
If you are interested in buying RabbitMax Flex Raspberry Pi HAT there is a small batch of units on sale at Tindie. Now I am preparing an IndieGoGo campaign for the winter of 2016 and I am trying hard to reduce the manufacturing costs and the end product price.