Nanopi Neo2には、GPIOが24ピンあるので、これを制御するためのライブラリー(WiringNP)をインストールします。
https://github.com/friendlyarm/WiringNP
pi@NanoPi-NEO2:~$ git clone https://github.com/friendlyarm/WiringNP
pi@NanoPi-NEO2:~$ cd WiringNP/
pi@NanoPi-NEO2:~$ chmod 755 build
pi@NanoPi-NEO2:~$ sudo ./build
pi@NanoPi-NEO2:~$ gpio readall
+-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
| | | 3.3V | | | 1 || 2 | | | 5V | | |
| 12 | 8 | GPIOA12 | ALT5 | 0 | 3 || 4 | | | 5V | | |
| 11 | 9 | GPIOA11 | ALT5 | 0 | 5 || 6 | | | 0v | | |
| 203 | 7 | GPIOG11 | OUT | 0 | 7 || 8 | 0 | ALT5 | GPIOG6 | 15 | 198 |
| | | 0v | | | 9 || 10 | 0 | ALT5 | GPIOG7 | 16 | 199 |
| 0 | 0 | GPIOA0 | ALT5 | 0 | 11 || 12 | 0 | OUT | GPIOA6 | 1 | 6 |
| 2 | 2 | GPIOA2 | OFF | 0 | 13 || 14 | | | 0v | | |
| 3 | 3 | GPIOA3 | OFF | 0 | 15 || 16 | 0 | OFF | GPIOG8 | 4 | 200 |
| | | 3.3v | | | 17 || 18 | 0 | OFF | GPIOG9 | 5 | 201 |
| 64 | 12 | GPIOC0 | ALT4 | 0 | 19 || 20 | | | 0v | | |
| 65 | 13 | GPIOC1 | ALT4 | 0 | 21 || 22 | 0 | ALT5 | GPIOA1 | 6 | 1 |
| 66 | 14 | GPIOC2 | ALT4 | 0 | 23 || 24 | 1 | OUT | GPIOC3 | 10 | 67 |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+----------+------+---+-NanoPi-NEO2--+------+----------+-----+-----+
+-----+----NanoPi-NEO2 USB/Audio-+----+
| BCM | wPi | Name | Mode | V | Ph |
+-----+-----+----------+------+---+----+
| | | 5V | | | 25 |
| | | USB-DP1 | | | 26 |
| | | USB-DM1 | | | 27 |
| | | USB-DP2 | | | 28 |
| | | USB-DM2 | | | 29 |
| | | IR-RX | | | 30 |
| 17 | 19 | GPIOA17 | OFF | 0 | 31 |
| | | PCM/I2C | | | 32 |
| | | PCM/I2C | | | 33 |
| | | PCM/I2C | | | 34 |
| | | PCM/I2C | | | 35 |
| | | 0V | | | 36 |
+-----+-----+----------+------+---+----+
+-----+----NanoPi-NEO2 Debug UART-+----+
| BCM | wPi | Name | Mode | V | Ph |
+-----+-----+----------+------+---+----+
| 4 | 17 | GPIOA4 | ALT5 | 0 | 37 |
| 5 | 18 | GPIOA5 | ALT5 | 0 | 38 |
+-----+-----+----------+------+---+----+
Pythonを使う時のライブラリー(RPi.GPIO_NP)をインストールします。
https://github.com/friendlyarm/RPi.GPIO_NP
pi@NanoPi-NEO2:~$ sudo apt-get install python3-dev
pi@NanoPi-NEO2:~$ git clone https://github.com/friendlyarm/RPi.GPIO_NP
pi@NanoPi-NEO2:~$ cd RPi.GPIO_NP
pi@NanoPi-NEO2:~$ sudo python3 setup.py install
vi led.py
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
PIN_NUM = 7
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN_NUM,GPIO.OUT)
while True:
GPIO.output(PIN_NUM,True)
time.sleep(1)
GPIO.output(PIN_NUM,False)
time.sleep(1)
pi@NanoPi-NEO2:~$ sudo python3 led.py
pipのインストール方法
pi@NanoPi-NEO2:~$ wget https://bootstrap.pypa.io/get-pip.py
pi@NanoPi-NEO2:~$ sudo python3 get-pip.py
確認方法
pi@NanoPi-NEO2:~$ pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)