/* This demo opens /dev/comedi0 and looks for an analog input subdevice. If it finds one, it measures one sample on each channel for each input range. The value NaN indicates that the measurement was out of range. */ #include #include #include #include #include #include #include #include extern int verbose_flag; extern int subdevice; extern int range; extern int channel; extern int aref; extern char *filename; comedi_t *device; int main(int argc, char *argv[]) { int n_subdevs; int n_chans,chan; int n_ranges; int range; int rangetype; int maxdata; lsampl_t data; double voltage; parse_options(argc,argv); device=comedi_open(filename); if(!device){ comedi_perror(filename); exit(0); } subdevice=comedi_find_subdevice_by_type(device,COMEDI_SUBD_AI,0); if(subdevice<0){ printf("no analog input subdevice found\n"); exit(0); } n_chans=comedi_get_n_channels(device,subdevice); for(chan=0;chan