首页 > 其他 > 详细

am335x -- led 控制

时间:2015-02-06 00:42:07      阅读:324      评论:0      收藏:0      [点我收藏+]

#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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!