forked from WiringPi/WiringPi
-
Notifications
You must be signed in to change notification settings - Fork 29
Quick Start
Banana Pi -BPI edited this page Jul 18, 2026
·
1 revision
gpio -v
gpio readallConfirm all of the following before output testing:
- the detected board and carrier are correct;
- the physical header orientation is known;
- the selected pin is a 3.3 V GPIO, not power, ground, a boot strap or a board-owned peripheral;
- the selected pin is documented as output-safe for the exact board revision.
gpio <command> ... wiringPi number
gpio -g <command> ... BCM-style column from gpio readall
gpio -1 <command> ... physical header number
After a hardware owner approves a physical output pin, substitute it for SAFE_PHYS_PIN:
gpio -1 mode SAFE_PHYS_PIN out
gpio -1 write SAFE_PHYS_PIN 1
gpio -1 read SAFE_PHYS_PIN
gpio -1 write SAFE_PHYS_PIN 0Do not copy a pin number from another Banana Pi model. BCM-style numbers in this project are compatibility identifiers from the board map; they are not proof that two SoCs share the same hardware numbering.
Choose the setup function that matches the intended numbering mode:
#include <wiringPi.h>
int main(void)
{
const int approved_bcm_pin = 0; /* replace after checking gpio readall */
if (wiringPiSetupGpio() < 0)
return 1;
pinMode(approved_bcm_pin, OUTPUT);
digitalWrite(approved_bcm_pin, HIGH);
delay(100);
digitalWrite(approved_bcm_pin, LOW);
return 0;
}Build:
gcc -Wall -Wextra -o gpio-example gpio-example.c -lwiringPiThe placeholder must be replaced with a pin approved for the exact board. A successful compile is not a hardware validation result.
Documentation for BPI-SINOVOIP/BPI-WiringPi2 · Verify the exact board, carrier, revision and voltage before driving GPIO.