Thanks Rusty,
I used chmod and was able to set the led brightness to
rw- rw- rw-. This along with a small correction in my program worked. I
should have specified led 4 brightness directory as
/sys/class/leds/beaglebone:green:usr3: , but had left out the word green
from the address. The Derek Molloy tutorial I was looking at was for the
original beaglebone, so there must be some changes with the BBB. My program
does now run without sudo, but as you indicated when the BBB is reset I
loose the 'w' priviledges and I have to use sudo. Code is below for
reference. I'll need to read up on udev, it looks complicated.
int main() {
cout << "Flash start" << endl;
FILE *LEDHandle = NULL;
char *LEDBrightness =
"/sys/class/leds/beaglebone:green:usr3/brightness";
for (int i=0;i<10;i++)
{
if((LEDHandle =fopen(LEDBrightness, "r+"))!=NULL){
fwrite("1", sizeof(char),1,LEDHandle);
fclose(LEDHandle);
}
sleep(1);
if((LEDHandle =fopen(LEDBrightness, "r+"))!=NULL){
fwrite("0", sizeof(char),1,LEDHandle);
fclose(LEDHandle);
}
sleep(1);
}
cout << "Flash stop" << endl;
return 0;
}
On Tuesday, February 11, 2014 4:22:14 PM UTC, Alastair Gilmore wrote:
>
> Hi,
> I've got Ubuntu installed on the BBB and have compiled a C++ Hellow
> World on Eclipse and a Ubuntu PC. I can SSH the program to my account on
> the BBB, and it runs ok. I then SSH a program to flash the LED (from Derek
> Molloy's tutorial) and although the terminal messages appear the LED
> doesn't flash. I understand that my BBB account doesn't have 'write'
> privileges for the LED, only Root has, but don't know how to make the
> program work or change these privileges. I've tried SUDO but that doesn't
> work either. Can anyone help me please.
> Thanks
> Alastair
>
--
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].
For more options, visit https://groups.google.com/groups/opt_out.