October 2017
Intermediate to advanced
586 pages
14h 8m
English
One-shot data capture is done through the sysfs interface. By reading the sysfs entry that corresponds to a channel, you'll capture only the data specific to that channel. Given a temperature sensor with two channels, one for the ambient temperature, and the other for the thermocouple temperature:
# cd /sys/bus/iio/devices/iio:device0 # cat in_voltage3_raw 6646
# cat in_voltage_scale 0.305175781
The processed value is obtained by multiplying the scale by the raw value:
Voltage value: 6646 * 0.305175781 = 2028.19824053
The device data sheet says the processed value is given in MV. In our case, it corresponds to 2.02819V.