hey all im trying to get the analog inputs working with C++ for a robot im building for a school project. i have to use C++ cause its a stipulation from the teacher. im running the stock angtrom linux kernel and here's what ive done/tried so far *echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots * also ive put this in the etc/properties file so that the file will automatically be loaded on boot and it seems to be working as i can still read the 2 different analog file directories through the terminal if i add this file through the media/BEAGLEBONE/unEc.txt (it might be uNec.txt)file all of the AIN ports in the helper.17 file disappear. i think it has something to do with the way the beaglebone loads the file on boot
*cat /sys/bus/iio/devices/iio:device0#/in_voltage5_raw //gives valu 0-4055cat /sys/devices/ocp.2/helper.17/AIN5 //gives value 0-1499* at the moment im using eclipse running on a ubuntu laptop and ive implemented some basic c++ programs on the beaglebone black so i know that the configuration works. but nomatter what i try i just cant seem to get the code im using to read the port correctly all i can get out of it how is a bunch of 0's here's the code // Name : AINRead.cpp // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <stdio.h> #include <unistd.h> using namespace std; //uncomment which file path you wish to use // gives value in terminal from 0 - 4055 //char *Remote = "/sys/bus/iio/devices/iio:device0#/in_voltage5_raw"; //gives value in terminal from 0 - 1499 //char *Remote = "/sys/devices/ocp.2/helper.17/AIN5"; FILE * raw_volt; int iteration = 0; int main() { //how its read in terminal *//cat /sys/bus/iio/devices/iio:device0#/in_voltage5_raw // gives value 0-4055 //cat /sys/devices/ocp.2/helper.17/AIN5 //gives value 0-1499* while(iteration < 1000) // how many times the loop runs { raw_volt = fopen(Remote, "r+"); // reads analog input and stores in variable raw_volt // on the off chance that the value stored in raw_volt is already string printf("raw_volt \n", raw_volt); char c[10]; //this segment should convert raw_volt to string sprintf(c,"%d",raw_volt); printf ("voltage in : %s \n", c); usleep(1000); iteration += 1; } } any help in deciphering what im doing wrong would be a big help also let me know if ive left any pertinent information out -- 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 beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.