[BPI-M3] BPI T-Type GPIO extend module and how to use


(BPI_Justin) #1

OS: BPI-M3 Ubuntu15.10 (Kernel3.4) Version: 1.0 HDMI


Step 1: Download WiringPI

$ git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git111 -b BPI_M3 $ cd BPI-WiringPi $ chmod +x ./build $ sudo ./build

Step 3 : Copy smaple code to led.c file

$ sudo vi led.c

Step 4 : Compile led.c

$ gcc -o led led.c -l wiringPi

Step 5: Run led

$ sudo ./led


Video Demo:


Sample Code:

#include <stdio.h>
#include <wiringPi.h>

#define	LED_1 8   //BPI SDA 
#define	LED_2 11  //BPI CE1 
#define	LED_3 0   //BPI GPIO0

int main (void)

{
  int i;
  printf ("BPI-M3 blink\n") ;
  //wiringPiSetupPhys() ;  //phy
  //wiringPiSetupGpio();   //bcm
   wiringPiSetup();        //wiringPi

  pinMode (LED_1, OUTPUT) ;
  pinMode (LED_2, OUTPUT) ;
  pinMode (LED_3, OUTPUT) ;

  for (;;)
  {
   digitalWrite (LED_1, HIGH) ;	// On
   digitalWrite (LED_2, HIGH) ;	
   digitalWrite (LED_3, HIGH) ;	
   delay (500) ;		// mS
   digitalWrite (LED_1, LOW) ;	// Off
   digitalWrite (LED_2, LOW) ;	
   digitalWrite (LED_3, LOW) ;	
   delay (500) ;
  }
  return 0 ;
}

more please see:

https://bananapi.gitbooks.io/bpi-accessories/content/gpioextendmodulet.html