I am trying to write counter output to a file when ir sensor detects
So, when i run the code and try to place object in front of the sensor, sometimes it hangs.. so i tried 100 iteration to write to file and noticed it do stuck at least 2 to 3 times in every 100 iteration..
Any idea hw to solve or better method ?
- Code: Select all
void detected(int count)
fp = fopen("raw", "w");
char buffer ;
snprintf(buffer, sizeof(buffer), "%d",count);
size_t len = 0;
fwrite(buffer, len, 1, fp);
for (int i=0;i<100;i++)