#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
int main(void)
{
FILE *p=NULL;
int i=0;
p = fopen("/sys/class/gpio/export","w");
fprintf(p,"%d",38);
fclose(p);
p =
fopen("/sys/class/gpio/gpio38/direction","w");
fprintf(p,"out");
fclose(p);
for(i=0;i<100;i++)
{
p =
fopen("/sys/class/gpio/gpio38/value","w");
fprintf(p,"%d",1);
sleep(1);
fclose(p);
p =
fopen("/sys/class/gpio/gpio38/value","w");
fprintf(p,"%d",0);
sleep(1);
fclose(p);
}
p = fopen("/sys/class/gpio/unexport","w");
fprintf(p,"%d",38);
fclose(p);
return 0;
}
am335x -- led 控制
原文:http://www.cnblogs.com/zym0805/p/4276208.html