树莓派gpio
http://www.eeboard.com/bbs/thread-6930-1-1.html
http://www.codelast.com/?p=5232
安装git-core
sudoapt-getinstallgit-core
下载winringPi库
gitclonegit://git.drogon.net/wiringPi
参考https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
可能需要apt-getintstalllibi2c-dev
i2c-tools,libi2c-dev,python-smbus
参考http://blog.csdn.net/liang890319/article/details/8643069
否则报错
/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libwiringPi.so: undefined reference to `i2c_smbus_write_byte' /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libwiringPi.so: undefined reference to `i2c_smbus_read_byte' /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libwiringPi.so: undefined reference to `i2c_smbus_write_byte_data' /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libwiringPi.so: undefined reference to `i2c_smbus_write_word_data' /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libwiringPi.so: undefined reference to `i2c_smbus_read_word_data' /usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../libwiringPi.so: undefined reference to `i2c_smbus_read_byte_data'
编译和安装库
cdwiringPi
./build
写了一段简单的测试代码: /********** test.c ***************/ #include <wiringPi.h> #include <stdlib.h> int main() { int i; if( wiringPiSetup() == -1 ) exit( 1 ); pinMode( 0, OUTPUT ); pinMode( 1, OUTPUT ); pinMode( 2, OUTPUT ); pinMode( 3, OUTPUT ); for(i = 0; i < 40; i++) { digitalWrite( i % 4, HIGH ); delay( 200 ); digitalWrite( i % 4, LOW ); delay( 200 ); } return 0; } /********** test.c ***************/ 编译&执行: cc -o test test.c -L/usr/local/lib -lwiringPi sudo ./test
相关推荐
LeeHDsniper 2020-11-05
橄榄 2020-11-03
wanshiyingg 2020-09-29
andonliu 2020-09-03
嵌入式开发爱好者 2020-08-28
lu00kill 2020-08-17
tianyayi 2020-08-16
LIEVEZ 2020-08-09
ohhardtoname 2020-07-25
LeeHDsniper 2020-07-19
shenxiuwen 2020-07-16
wzxxtt0 2020-06-25
mattraynor 2020-06-25
咏月东南 2020-06-10
wangz 2020-06-03
wanxuncpx 2020-06-01
tianyayi 2020-05-18
wanxuncpx 2020-05-15
mattraynor 2020-05-12
wzxxtt0 2020-05-12
LIEVEZ 2020-05-04
mattraynor 2020-05-01
LIEVEZ 2020-05-01
LIEVEZ 2020-05-01
LowisLucifer 2020-04-23
OathKeeper 2020-04-22
zcabcd 2020-04-18
wanxuncpx 2020-04-16
returnspace 2020-04-16
mattraynor 2020-04-14
tianyayi 2020-03-28
clamzxf 2020-03-28
Summer的小屋 2020-03-26
lu00kill 2020-03-17
yuancr 2020-03-04
wzxxtt0 2020-02-21
xinhao 2020-02-20
LIEVEZ 2020-02-17
wzxxtt0 2020-02-15
zhufu 2020-02-10