基于am3358的蜂鸣器测试

来源:互联网 发布:育知同创教育位置 编辑:程序博客网 时间:2024/06/12 01:32
#include <sys/ioctl.h>#include<stdio.h>#include <fcntl.h>#include <sys/types.h>static int fb;int main(){  int i=0;  printf("hello world !\n");  fb = open("/dev/beep", O_RDWR);  if (fb < 0)  {     perror("open device beep fail");  }  for(i=0;i<100;i++)  {     ioctl(fb, 1, i);      usleep(200000);  }   ioctl(fb, 0, 1);//关闭蜂鸣器驱动close();  return 0;}

0 0
原创粉丝点击