OS: BPI-M3 Ubuntu15.10 (Kernel3.4) Version: 1.0 HDMI
Step 1: Download WiringPI
$ git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git -b BPI_M3 $ cd BPI-WiringPi $ chmod +x ./build $ sudo ./build
Step 2 : Copy smaple code to BerryClip.c file
$ sudo vi BerryClip.c
Step 3 : Compile BerryClip.c
$ gcc -o BerryClip BerryClip.c -l wiringPi
Step 4 : Run BerryClip
$ sudo ./BerryClip
Step 5: Press the button to see if it works
Video Demo:
Sample Code:
#include <wiringPi.h>
int LED1[]={7,0,3,12,13,14};
int i;
int initIO()
{
pinMode(7,OUTPUT);
pinMode(0,OUTPUT);
pinMode(3,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(14,OUTPUT);
}
int LED()
{
for(i=0;i<=6;i++)
{
digitalWrite(LED1[i],1);
delay(500);
digitalWrite(LED1[i],0);
delay(500);
}
}
int main()
{
int val;
wiringPiSetup();
initIO();
pinMode(10,INPUT);
digitalWrite(11,1);
while(1)
{
val=digitalRead(10);
if(val==0)
{
LED();
digitalWrite(11,1);
i=0;
}
}
}
more about BPI berryChip 6 LED moudle:
https://bananapi.gitbooks.io/bpi-accessories/content/berryclip.html