Raspberry Pi, WiringPi 라이브러리 설치에 대한 부분입니다.
1. git clone git://git.drogon.net/wiringPi
2. cd wiringPi
3. git pull origin
4. ./build
pi@raspberrypi:~/wiringPi$ ./build wiringPi Build script =====================
WiringPi Library [UnInstall] [Compile] wiringPi.c [Compile] wiringSerial.c [Compile] wiringShift.c [Compile] piThread.c [Compile] piHiPri.c [Compile] wiringPiSPI.c [Compile] wiringPiI2C.c [Compile] softPwm.c [Compile] softTone.c [Compile] mcp23008.c [Compile] mcp23016.c [Compile] mcp23017.c wiringPi.c:1309:21: warning: ‘digitalWrite8Dummy’ defined but not used [-Wunused-function] static void digitalWrite8Dummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; } ^~~~~~~~~~~~~~~~~~ wiringPi.c:1308:21: warning: ‘digitalRead8Dummy’ defined but not used [-Wunused-function] static unsigned int digitalRead8Dummy (UNU struct wiringPiNodeStruct *node, UNU int UNU pin) { return 0 ; } ^~~~~~~~~~~~~~~~~ [Compile] mcp23s08.c [Compile] mcp23s17.c [Compile] pcf8574.c [Compile] sr595.c [Compile] pcf8591.c [Compile] mcp3002.c [Compile] mcp3004.c [Compile] mcp4802.c [Compile] mcp3422.c [Compile] max31855.c [Compile] ads1115.c [Compile] max5322.c [Compile] sn3218.c [Compile] bmp180.c [Compile] htu21d.c [Compile] ds18b20.c [Compile] rht03.c [Compile] drcSerial.c [Compile] drcNet.c [Compile] pseudoPins.c [Compile] wpiExtensions.c [Link (Dynamic)] [Install Headers] [Install Dynamic Lib]
WiringPi Devices Library [UnInstall] [Compile] ds1302.c [Compile] maxdetect.c [Compile] piNes.c [Compile] gertboard.c [Compile] piFace.c [Compile] lcd128x64.c [Compile] lcd.c [Compile] scrollPhat.c [Compile] piGlow.c [Link (Dynamic)] [Install Headers] [Install Dynamic Lib]
GPIO Utility [Compile] gpio.c [Compile] readall.c [Link] [Install]
All Done.
NOTE: To compile programs with wiringPi, you need to add: -lwiringPi to your compile line(s) To use the Gertboard, MaxDetect, etc. code (the devLib), you need to also add: -lwiringPiDev to your compile line(s).
pi@raspberrypi:~/wiringPi$ |
5. gpio 사용법
- gpio -g mode 핀번호 input( 혹은 output)
- gpio -g write 핀번호 1( 혹은 0)
- gpio -g mode 핀번호 up ( 혹은 down, tri )
- 핀번호는 BCM 기준이다
6. ~/wiringPi 디렉토리 구조

7. gpio readall

8. gpio output test
BCM 17번 핀을 Output 모드로 변경

9. gpio output test
BCM 17번 핀 값을 High로 변경

10. ~/wiringPi/example 디렉토리 구조
