Hi All,

I have updated the image which is running of SD card
root@beaglebone:/tmp# uname -a
Linux beaglebone 4.4.84-ti-r120 #1 SMP Sun Aug 27 03:11:07 UTC 2017 armv7l 
GNU/Linux

have a very simple cpp program which used to work, and now doesn't; when 
running gives error
"./adctest: error while loading shared libraries: libprussdrv.so: cannot 
open shared object file: No such file or directory "

Any Help would be greatly appreciated

Warm Regards,
MB




//#define ultrasonic1 0    
//#define ultrasonic2 1    
//#define ultrasonic3 3    

#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <bitset>

using namespace std;

        #include <unistd.h>
        #include <sys/stat.h>
        #include <fcntl.h>
        #include <stdio.h>
        #include <errno.h>
        #include <stdlib.h>
#include <string.h>

        int main()
        {
                const char *ultrasonic1 = 
"/sys/bus/iio/devices/iio:device0/in_voltage0_raw";
                const char *ultrasonic2 = 
"/sys/bus/iio/devices/iio:device0/in_voltage1_raw";
                const char *ultrasonic3 = 
"/sys/bus/iio/devices/iio:device0/in_voltage2_raw";
                int fd, len, ultrasonic1reading,ultrasonic2reading,
ultrasonic3reading;
                unsigned long count = 0;
                unsigned long errorcount = 0;
                char adc[5] = {0};



                while(1){

                        fd = open(ultrasonic1, O_RDONLY|O_NONBLOCK);
                        if(fd == -1){
                                printf("error: %s %d\n", strerror(errno), 
errno);
                                printf(" Cannot open file");
                                errorcount++;
                                exit(1);
                        }


                        len = read(fd, adc, sizeof(adc - 1));

                        if(len == -1){
                                close(fd);
                                printf(" error with read data ");
                                errorcount++;
                                continue;
                        }
                        else if(len == 0){
                                printf("%s\n", "buffer is empty");
                                errorcount++;
                        }
                        else{
                                adc[len] ='\0';
                                cout << " 3 ";
                                printf("%s ", adc);
                        }

                        close(fd);

                        cout << "count is " << count << " errors " <<errorcount 
<< '\n';
                        count++;
                }

                return  0;
        }



-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/363bc75b-1017-44fd-b3bf-76225d3ac303%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to