Advertisement
silver2row

A post from a user on forum.beagleboard.org

Oct 26th, 2021
1,636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>      // for printf()
  2. #include <unistd.h>     // for sleep()
  3.  
  4. int main() {
  5.  
  6.         FILE *fp;
  7.         char buff[8];
  8.  
  9.         while(1) {
  10.         fp = fopen("voltageP9_39", "r");    // voltageP9_39 -> /sys/bus/iio/devices/iio:device0/in_voltage0_raw
  11.         fscanf(fp, "%s", buff);
  12.         printf("value : %s\n", buff );
  13.         sleep(0.2);
  14.         fclose(fp);
  15.         }
  16.         return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement