Dear all,
I m trying to use the ledc.h library.
I have no signal on the oscilloscope. I should have got a length of 200 ms at 50% LOW, 50% HIGH. I have done a mistake but wich one? I have set frequency to 5000Hz. I put a resolution of 1 bit and 50% cyclacity. Why there s no signal? Thanks
[code]
#include "driver/ledc.h"
const int dcc_pin = 19; // choix de la broche dcc out : n'importe laquelle peut être utilisée /// en se servant de la matrice du gpio
// setting PWM properties
#define dcc_sig_1_freq 8621 // fréquency of ~116µs
#define dcc_sig_0_freq 5000 // fréquency of 200µs
const int pin_channel = 0; // choice of te channel PWM = 0
const int sig_resolution = 1; // resolution = 1 bit => 2^1 = 0,1,2
const int sig_duty = 1; // cyclacity of 1/2 or 50% 1 is 50% or 1/2^1
uint32_t sig_freq = dcc_sig_0_freq; // set the frequency
void setup() {
ledcAttachPin(dcc_pin, pin_channel); /// attach pin 19 to channel PWM
ledcSetup(pin_channel,sig_freq, sig_resolution); //freauency of 5000 or 8621
ledcWrite(pin_channel, sig_duty); // set channel 0 with a cyclacity of 50%
}
void loop() {
delay(10);
}
[/code]