#include<stdio.h>
#include<fcntl.h>
#include<stdlib.h>
#include<unistd.h>
int fd;
int len;
char buf[30];
int main()
{
while(1)
{
fd = open("/sys/devices/platform/c0000000.soc/c0053000.adc/iio:device0/in_voltage7_raw", 0);
if(fd < 0) exit(1);
sleep(1);
len = read(fd, buf, sizeof(buf)-1);
if(len > 0)
{
buf[len] = '\0';
printf("%s\n", buf);
}
close(fd);
}
}
Linux之读取FriendlyArm友善之臂的A/D接口数据
最新推荐文章于 2021-05-03 22:47:33 发布