I just wanted to share some instructions on how to control all GPIO pins on the OrangePi Zero Plus 2 board. These instructions are meant for newbies but it can be extremely helpful if you are new to Armbian, OPI and GPIO. At least it would have been for me.
There is a total of 17 different pins to control according to the schematic below. These pins are highlighted in blue numbers that indicate what GPIO port they are available at. Use these numbers in order to know that pins to control. Look for instructions further down.
First off some basics:
Activate a pin by exporting it. For example. In order to activate IO-0 run: echo "352" > /sys/class/gpio/export
Set the direction of the port. echo "out" > /sys/class/gpio/gpio352/direction
Turn it on: echo "1" > /sys/class/gpio/gpio352/value
Turn it off: echo "0" > /sys/class/gpio/gpio352/value
To figure out what number to use for each pin follow the schematics above or read from the list below. I really have not figured out wether it is safe to control all pins(and not just IO-pins) for output but it seems to work when I verify with a voltmeter. These pins were identified using the official schematic for the board: http://linux-sunxi.org/File:ORANGE_PI-ZERO-PLUS2_V1_0.pdf
If you are interested to learn how pins are identified based on the schematic please dig deeper into these files in the GIT repo:
https://github.com/armbian/linux/blob/sun8i/drivers/pinctrl/pinctrl-sunxi.h
https://github.com/armbian/linux/blob/sun8i/arch/arm/mach-sunxi/include/mach/pinctrl.h
The simplest way is to use gpio sysfs ...
echo 20 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio20/direction
echo 1 > /sys/class/gpio/gpio20/value