いちいちCloseしないと反映されなかった.
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
FILE *LEDHandle = NULL;
const char *LEDBrightness = "/sys/class/leds/beaglebone::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);
}
return 0;
}