I'm not a C developer but i need to write simple program and i have problems with delay. Here is my program:
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <wiringPi.h>
#include <softPwm.h>
int main (int argc, char *argv[])
{
int val = 10;
if (argc > 1) {
val = atoi(argv[1]);
}
wiringPiSetup () ;
pinMode(1, OUTPUT);
softPwmCreate (1, 0, 100) ;
printf ("Soft Pwm created: %s!\n", argv[1]) ;
softPwmWrite (1, val) ;
delay (200);
return 0;
}
And it works pretty well until i delete row with delay (200). How can i wait until function softPwmWrite complete without delay() before program has done? Im' using Linux and wiringPi library. Thanks.