Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
projects:gpio [2016/06/14 03:01] over23 created |
projects:gpio [2016/06/14 03:12] over23 |
||
---|---|---|---|
Line 1: | Line 1: | ||
http://wiringpi.com/download-and-install/ | http://wiringpi.com/download-and-install/ | ||
+ | |||
+ | <code> | ||
+ | sudo su - | ||
+ | aptitude install git-core && aptitude update && aptitude upgrade | ||
+ | git clone git://git.drogon.net/wiringPi | ||
+ | git clone git://git.drogon.net/wiringPi | ||
+ | </code> | ||
+ | or | ||
+ | <code> | ||
+ | cd ~/wiringPi/ && git pull origin | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | [root@picka_malinova wiringPi]# cd ~/wiringPi | ||
+ | [root@picka_malinova wiringPi]# ./build | ||
+ | |||
+ | |||
+ | ./build | ||
+ | wiringPi Build script | ||
+ | ===================== | ||
+ | |||
+ | |||
+ | WiringPi Library | ||
+ | sudo: unable to resolve host picka_malinova | ||
+ | [UnInstall] | ||
+ | [Compile] wiringPi.c | ||
+ | [Compile] wiringSerial.c | ||
+ | [Compile] wiringShift.c | ||
+ | [Compile] piHiPri.c | ||
+ | [Compile] piThread.c | ||
+ | [Compile] wiringPiSPI.c | ||
+ | [Compile] wiringPiI2C.c | ||
+ | [Compile] softPwm.c | ||
+ | [Compile] softTone.c | ||
+ | [Compile] mcp23008.c | ||
+ | [Compile] mcp23016.c | ||
+ | [Compile] mcp23017.c | ||
+ | [Compile] mcp23s08.c | ||
+ | [Compile] mcp23s17.c | ||
+ | [Compile] sr595.c | ||
+ | [Compile] pcf8574.c | ||
+ | [Compile] pcf8591.c | ||
+ | [Compile] mcp3002.c | ||
+ | [Compile] mcp3004.c | ||
+ | [Compile] mcp4802.c | ||
+ | [Compile] mcp3422.c | ||
+ | [Compile] max31855.c | ||
+ | [Compile] max5322.c | ||
+ | [Compile] ads1115.c | ||
+ | [Compile] sn3218.c | ||
+ | [Compile] drcSerial.c | ||
+ | [Compile] wpiExtensions.c | ||
+ | [Link (Dynamic)] | ||
+ | sudo: unable to resolve host picka_malinova | ||
+ | [Install Headers] | ||
+ | [Install Dynamic Lib] | ||
+ | |||
+ | WiringPi Devices Library | ||
+ | sudo: unable to resolve host picka_malinova | ||
+ | [UnInstall] | ||
+ | [Compile] ds1302.c | ||
+ | [Compile] gertboard.c | ||
+ | [Compile] maxdetect.c | ||
+ | [Compile] piNes.c | ||
+ | [Compile] piFace.c | ||
+ | [Compile] lcd128x64.c | ||
+ | [Compile] lcd.c | ||
+ | [Compile] scrollPhat.c | ||
+ | [Compile] piGlow.c | ||
+ | [Link (Dynamic)] | ||
+ | sudo: unable to resolve host picka_malinova | ||
+ | [Install Headers] | ||
+ | [Install Dynamic Lib] | ||
+ | |||
+ | GPIO Utility | ||
+ | [Compile] gpio.c | ||
+ | [Compile] readall.c | ||
+ | [Compile] pins.c | ||
+ | [Link] | ||
+ | sudo: unable to resolve host picka_malinova | ||
+ | [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). | ||
+ | |||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | [root@picka_malinova wiringPi]# gpio -v | ||
+ | gpio version: 2.32 | ||
+ | Copyright (c) 2012-2015 Gordon Henderson | ||
+ | This is free software with ABSOLUTELY NO WARRANTY. | ||
+ | For details type: gpio -warranty | ||
+ | |||
+ | Raspberry Pi Details: | ||
+ | Type: Model B, Revision: 03, Memory: 512MB, Maker: Sony | ||
+ | * Device tree is enabled. | ||
+ | * This Raspberry Pi supports user-level GPIO access. | ||
+ | -> See the man-page for more details | ||
+ | -> ie. export WIRINGPI_GPIOMEM=1 | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | [root@picka_malinova wiringPi]# gpio readall | ||
+ | +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+ | ||
+ | | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | | ||
+ | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | ||
+ | | | | 3.3v | | | 1 || 2 | | | 5v | | | | ||
+ | | 2 | 8 | SDA.1 | ALT0 | 1 | 3 || 4 | | | 5V | | | | ||
+ | | 3 | 9 | SCL.1 | ALT0 | 1 | 5 || 6 | | | 0v | | | | ||
+ | | 4 | 7 | GPIO. 7 | IN | 0 | 7 || 8 | 0 | IN | TxD | 15 | 14 | | ||
+ | | | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 | | ||
+ | | 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 | | ||
+ | | 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | | | ||
+ | | 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 | | ||
+ | | | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 | | ||
+ | | 10 | 12 | MOSI | ALT0 | 0 | 19 || 20 | | | 0v | | | | ||
+ | | 9 | 13 | MISO | ALT0 | 0 | 21 || 22 | 1 | IN | GPIO. 6 | 6 | 25 | | ||
+ | | 11 | 14 | SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT | CE0 | 10 | 8 | | ||
+ | | | | 0v | | | 25 || 26 | 1 | OUT | CE1 | 11 | 7 | | ||
+ | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | ||
+ | | 28 | 17 | GPIO.17 | IN | 0 | 51 || 52 | 0 | IN | GPIO.18 | 18 | 29 | | ||
+ | | 30 | 19 | GPIO.19 | IN | 0 | 53 || 54 | 0 | IN | GPIO.20 | 20 | 31 | | ||
+ | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | ||
+ | | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | | ||
+ | +-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+ | ||
+ | [root@picka_malinova wiringPi]# | ||
+ | </code> | ||
+ | |||
+ | |||
+ | http://wiringpi.com/wiringpi-update-to-2-29/ | ||
+ | |||
+ | <code> | ||
+ | vim /etc/udev/rules.d/20-gpio.rules | ||
+ | </code> | ||
+ | * add there | ||
+ | <code> | ||
+ | SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="gpio", MODE="0660" | ||
+ | SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'" | ||
+ | SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"</code> | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | echo "setenv WIRINGPI_GPIOMEM 1' >> ~/.bashrc | ||
+ | </code> |