Home > Back-end >  I read the fd on BBB board pointing to the data on the path (the data for the four digits, such as 2
I read the fd on BBB board pointing to the data on the path (the data for the four digits, such as 2

Time:10-13

# include
# include
# include
# include
# include
# define SYSFS_ADC_DIR "/sys/bus/iio/devicesi/iio: device0/in_voltage0_raw"
# define MAX_BUF 64

Void main () {
Int fd, len;
Char buf [MAX_BUF];
Int ch [5];
int i;

for(i=0; i<50; I++) {snprintf (buf, sizeof (buf), SYSFS_ADC_DIR);
Fd=open (buf, O_RDONLY);
Read (fd, ch, 4);
Printf (" % s \ n ", ch);
Close (fd);
Usleep (1000);
}
}

CodePudding user response:

Defines e int e [5], read four digits, using fread (e, 4, 4, ch)?
  • Related