When you need to use GPIO for input or output and other interface. You can use library of chip bcm2835. Download library and setup below.
1. Download last file library of bcm2835
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.34.tar.gz
2. Extract compress file
tar xzvf bcm2835-1.34.tar.gz
3. Go to folder
cd bcm2835-1.34
4. Configure
./configure
5. Make
make
6. Install
sudo make install
7. Run Example
cd examples/blink
8. Compile
gcc -o blink -l rt blink.c -l bcm2835
9. then run the blink exe with this command:
sudo ./blink
If you connect the positive pin of a 5V LED to pin 11 of the P1 header it should be blinking. Use CTRL+Break or CTRL+SHIFT+C to stop the exe.
No comments:
Post a Comment