Hi.
I'm using latest version of nrf51-pwm-library to test if PWM works fine, but unfortunately, it's not. I have very simple program which should fade LED from 255 to 0 in infinite loop, but instead fading, I can see LED light on 100% and then turn off (blink instead fade). When I debug, I notice, LED is on (without any fading) when i > 0 and LED is off when i == 0.
Any suggestions? Btw no softdevice is used so far.
This is how my code look like:
#include <stdbool.h>
#include <stdint.h>
#include "nrf.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "nrf_pwm.h"
#include "boards.h"
int main(void)
{
nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;
pwm_config.mode = PWM_MODE_LED_255;
pwm_config.num_channels = 1;
pwm_config.gpio_num[0] = 9;
// Initialize the PWM library
nrf_pwm_init(&pwm_config);
for(uint8_t i = 255; i >= 0; i--){
nrf_pwm_set_value(0, i);
nrf_delay_ms(100);
}
}