I was messing arround with PWM and wiringPi in C++ language, but I found out that there was a better library (might be the most updated) called pigpio. Since I was new to this I was trying to the the blinking test, to test out the functions. Now here is my problem, when I wrote the code to put digital pin to high and right after to low, with a delay in between, the led doesn't blink, it just stays in high value. The other problem I found out is that when I change for() cycle to an interval like for(i=0; i<10; i++) the code is executed like there is no interval, meaning the led should blink atleast 10 times but it doesn't blink even once.
I also tried PWM in that pin and doesn't work because of the problem with the for() cycle being executed instantly.
My code:
/* Libraries */
#include <iostream>
#include <pigpio.h>
/* Variables and Constants */
using namespace std;
#define LED 17
#define HIGH 0x1
#define LOW 0x0
/* Main function */
int main(void)
{
cout << "Raspberry Pi initialized!" << endl;
if (gpioInitialise() < 0) exit(1);
gpioSetMode(LED, PI_OUTPUT); // 3.3V PIN
for (;;)
{
gpioWrite(LED, HIGH);
gpioDelay(500);
gpioWrite(LED, LOW);
gpioDelay(500);
}
gpioTerminate();
}