forked from WiringPi/WiringPi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,828 additions
and
424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
How to install wiringPi | ||
======================= | ||
|
||
The easiest way is to use the supplied 'build' script: | ||
|
||
./build | ||
|
||
that should do a complete install or upgrade of wiringPi for you. | ||
|
||
That will install a dynamic library. | ||
|
||
Some distributions do not have /usr/local/lib in the default LD_LIBRARY_PATH. To | ||
fix this, you need to edit /etc/ld.so.conf and add in a single line: | ||
|
||
/usr/local/lib | ||
|
||
then run the ldconfig command. | ||
|
||
sudo ldconfig | ||
|
||
If you want to install a static library, you may need to do this manually: | ||
|
||
cd wiringPi | ||
make static | ||
sudo make install-static | ||
|
||
|
||
To un-install wiringPi: | ||
|
||
./build uninstall | ||
|
||
|
||
I2C: | ||
|
||
If your system has the correct i2c-dev libraries and headers installed, | ||
then the I2C helpers will be compiled into wiringPi. If you want to | ||
use the I2C helpers and don't have them installed, then under Raspbian, | ||
issue the command: | ||
|
||
sudo apt-get install libi2c-dev | ||
|
||
Consult the documentation for your system if you are not running Raspbian. | ||
|
||
Gordon Henderson | ||
|
||
[email protected] | ||
https://projects.drogon.net/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
wiringPi README | ||
=============== | ||
|
||
Please note that the official way to get wiringPi is via git from | ||
git.drogon.net and not GitHub. | ||
|
||
ie. | ||
|
||
git clone git://git.drogon.net/wiringPi | ||
|
||
The version of wiringPi held on GitHub by "Gadgetoid" is used to build the | ||
wiringPython, Ruby, Perl, etc. wrappers for these other languages. This | ||
version may lag the official Drogon release. Pull requests may not be | ||
accepted to Github.... | ||
|
||
Please see | ||
|
||
https://projects.drogon.net/raspberry-pi/wiringpi/ | ||
|
||
for the official documentation, etc. and the best way to submit bug reports, etc. | ||
is by sending an email to [email protected] | ||
|
||
Thanks! | ||
|
||
-Gordon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
#!/bin/bash | ||
|
||
check-make-ok() | ||
{ | ||
if [ $? != 0 ]; then | ||
echo "" | ||
echo "Make Failed..." | ||
echo "Please check the messages and fix any problems. If you're still stuck," | ||
echo "then please email all the output and as many details as you can to" | ||
echo " [email protected]" | ||
echo "" | ||
exit 1 | ||
fi | ||
} | ||
|
||
if [ x$1 = "xclean" ]; then | ||
echo Cleaning | ||
echo | ||
|
@@ -9,8 +22,10 @@ if [ x$1 = "xclean" ]; then | |
make clean | ||
cd ../examples | ||
make clean | ||
cd .. | ||
elif [ x$1 = "xuninstall" ]; then | ||
exit | ||
fi | ||
|
||
if [ x$1 = "xuninstall" ]; then | ||
echo Uninstalling | ||
echo | ||
echo "WiringPi library" | ||
|
@@ -21,24 +36,50 @@ elif [ x$1 = "xuninstall" ]; then | |
cd ../gpio | ||
sudo make uninstall | ||
cd .. | ||
else | ||
echo wiringPi Build script - please wait... | ||
exit | ||
fi | ||
|
||
|
||
echo "wiringPi Build script" | ||
echo "=====================" | ||
echo | ||
|
||
# Check for I2C being installed... | ||
# ... and if-so, then automatically make the I2C helpers | ||
|
||
if [ -f /usr/include/linux/i2c-dev.h ]; then | ||
grep -q i2c_smbus_read_byte /usr/include/linux/i2c-dev.h | ||
if [ $? = 0 ]; then | ||
target=i2c | ||
echo "Building wiringPi with the I2C helper libraries." | ||
else | ||
target=all | ||
echo "The wiringPi I2C helper libraries will not be built." | ||
fi | ||
fi | ||
|
||
echo | ||
echo "WiringPi library" | ||
cd wiringPi | ||
make | ||
sudo make uninstall | ||
make $target | ||
check-make-ok | ||
sudo make install | ||
check-make-ok | ||
|
||
echo | ||
echo "GPIO Utility" | ||
cd ../gpio | ||
make | ||
check-make-ok | ||
sudo make install | ||
echo | ||
echo "Examples" | ||
cd ../examples | ||
make | ||
cd .. | ||
fi | ||
check-make-ok | ||
|
||
# echo | ||
# echo "Examples" | ||
# cd ../examples | ||
# make | ||
# cd .. | ||
|
||
echo | ||
echo All Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* blink.c: | ||
* Standard "blink" program in wiringPi. Blinks an LED connected | ||
* to the first GPIO pin. | ||
* | ||
* Copyright (c) 2012-2013 Gordon Henderson. <[email protected]> | ||
*********************************************************************** | ||
* This file is part of wiringPi: | ||
* https://projects.drogon.net/raspberry-pi/wiringpi/ | ||
* | ||
* wiringPi is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* wiringPi is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with wiringPi. If not, see <http://www.gnu.org/licenses/>. | ||
*********************************************************************** | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <wiringPi.h> | ||
|
||
// LED Pin - wiringPi pin 0 is BCM_GPIO 17. | ||
|
||
#define LED 0 | ||
|
||
int main (void) | ||
{ | ||
printf ("Raspberry Pi blink\n") ; | ||
|
||
if (wiringPiSetup () == -1) | ||
return 1 ; | ||
|
||
pinMode (LED, OUTPUT) ; | ||
|
||
for (;;) | ||
{ | ||
digitalWrite (LED, 1) ; // On | ||
delay (500) ; // mS | ||
digitalWrite (LED, 0) ; // Off | ||
delay (500) ; | ||
} | ||
return 0 ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// blink.rtb: | ||
// Blink program in Return to Basic | ||
// | ||
// Copyright (c) 2012-2013 Gordon Henderson. <[email protected]> | ||
//********************************************************************** | ||
// This file is part of wiringPi: | ||
// https://projects.drogon.net/raspberry-pi/wiringpi/ | ||
// | ||
// wiringPi is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// wiringPi is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with wiringPi. If not, see <http://www.gnu.org/licenses/>. | ||
*********************************************************************** | ||
// | ||
PinMode (0, 1) // Output | ||
CYCLE | ||
DigitalWrite (0, 1) // Pin 0 ON | ||
WAIT (0.5) // 0.5 seconds | ||
DigitalWrite (0, 0) | ||
WAIT (0.5) | ||
REPEAT | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
# | ||
# blink.sh: | ||
# Standard "blink" program in wiringPi. Blinks an LED connected | ||
# to the first GPIO pin. | ||
# | ||
# Copyright (c) 2012-2013 Gordon Henderson. <[email protected]> | ||
####################################################################### | ||
# This file is part of wiringPi: | ||
# https://projects.drogon.net/raspberry-pi/wiringpi/ | ||
# | ||
# wiringPi is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# wiringPi is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with wiringPi. If not, see <http://www.gnu.org/licenses/>. | ||
####################################################################### | ||
|
||
# LED Pin - wiringPi pin 0 is BCM_GPIO 17. | ||
|
||
LED=0 | ||
|
||
gpio mode $PIN out | ||
|
||
while true; do | ||
gpio write $PIN 1 | ||
sleep 0.5 | ||
gpio write $PIN 0 | ||
sleep 0.5 | ||
done |
Oops, something went wrong.