- This project is for turning on LEDs in Linux platform using C programming language.
- Project status: finished
Youtube video: link
The code will works with the requirements below.
- Ubuntu
- Raspberri Pi 3 above
- LED x 3
- 300Ω of resistor x 3
- Female to male jumper wire x 4
- Breadboard
The Figure below is representing how to setup the circuit for this project.
- Red jumper for GPIO_17.
- Green jumper for GPIO_24.
- Yellow jumper for GPIO_25.
- Orange jumper for ground.
-
First of all, clone this repository with the following command.
$ git clone https://github.com/TanapolHongsuwan/LED-RaspPi-DeviceDrivers.git $ cd LED-RaspPi-DeviceDrivers
-
In the folder, type "make" and if there is no target mentioned at the beginning (or old), the process of that target will run.
$ make
Makefile:4: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
This is an error after you clone the Makefile's code.
- In this case, you should check Makefile and change all spaces in to TAB.
-
Install the modules.
$ sudo insmod myled.ko
-
In this case, to erase the old module and kernel module in order to make (compile) the new one.
$ sudo rmmod myled $ make clean
-
-
Change the permissions on the resulting /dev/myled0
$ sudo chmod 666 /dev/myled0
There are 4 patterns for running LED in this program.
-
Only red LED
$ echo 1 > /dev/myled0
-
Only green LED
$ echo 2 > /dev/myled0
-
Only white LED
$ echo 3 > /dev/myled0
-
LEDs' show
$ echo 4 > /dev/myled0
-
To turn off all the LEDs.
$ echo 0 > /dev/myled0
This is my first project with Raspberry Pi based on Prof. Ryuichi Ueda's template code, learning about device driver by Raspberry Pi and LED on Ubuntu. I've written this in English because I wish I could use this repository to share knowledge with not only Japanese, but all programmers around the world somedays in the future.
Prof. Ryuichi Ueda/robosys_device_drivers
Thanks to Yuya Sakamoto