Hello Im using geany to write my c codes. Below is my code to make the internal LED of beaglebone flashing. But i cant seem to use the sleep or delay to make the program wait for a couple of miliseconds. I've included all include files that i can find but none of it solve the problem. Any help is much appreciated
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <termios.h>
#include <time.h>
#include <pthread.h>
#include <semaphore.h>
#include <assert.h>
using namespace std;
int main() {
int i=0;
printf("LED Flash Start\n");
FILE *LEDHandle = NULL ;
const char *LEDBrightness = "/sys/class/leds/beaglebone:green:usr0/brightness";
while(i<10){
if((LEDHandle = fopen(LEDBrightness, "r+"))!=NULL){
fwrite("1", sizeof(char), 1, LEDHandle);
fclose(LEDHandle);
}
Sleep(1000);
if((LEDHandle = fopen(LEDBrightness, "r+"))!=NULL){
fwrite("0", sizeof(char), 1, LEDHandle);
fclose(LEDHandle);
}
Sleep(1000);
}
printf("LED Flash Stop\n");
return 0;
}