These are chat archives for me-no-dev/ESP31B

12th
Dec 2016
Victor Tseng
@Palatis
Dec 12 2016 19:30
do I have to call anything for the LEDC PWM driver to work?
or just ledcSetup(0, 1000, 16); ledcAttachPin(20, 0); ledcWrite(0, 12345);?
yes
that's all
Victor Tseng
@Palatis
Dec 12 2016 19:32
strange, the LEDs are not lit.
Me No Dev
@me-no-dev
Dec 12 2016 19:33
pin 20?
where is that pin?
16 bits might be too much also
Victor Tseng
@Palatis
Dec 12 2016 19:33
ahh i just made a number, i'm trying to do 6 channel
Me No Dev
@me-no-dev
Dec 12 2016 19:33
but I doubt it for 1KHz
what are your settings?
for freq and bits
Victor Tseng
@Palatis
Dec 12 2016 19:34
void setup() {
    Serial.begin(115200);

    // setup for 16bit PWM @ 1000hz
    ledcSetup(0, 500, 16);
    ledcSetup(1, 500, 16);
    ledcSetup(2, 500, 16);
    ledcSetup(3, 500, 16);
    ledcSetup(4, 500, 16);
    ledcSetup(5, 500, 16);
    ledcAttachPin(34, 0); // G
    ledcAttachPin(35, 1); // R
    ledcAttachPin(32, 2); // B
    ledcAttachPin(33, 3); // G
    ledcAttachPin(25, 4); // R
    ledcAttachPin(26, 5); // B
}
and slowly increase the duty cycle in loop()
pin -> led -> gnd
Me No Dev
@me-no-dev
Dec 12 2016 19:37
uint32_t frequency = 80000000/((div_num / 256.0)*(1 << bit_num));
should be OK
Victor Tseng
@Palatis
Dec 12 2016 19:38
i thought 1khz might be too fast, so changed to 500, but still didn't work.
pulling out my multimeter...
Me No Dev
@me-no-dev
Dec 12 2016 19:39
ledcSetup will return the frequency it was able to set
can you check what is the result?
btw it should work and be fine
I have tested ledc, sd and dac to output what they should
34 and 35 will not work, they are only inputs
the others should be fine
Victor Tseng
@Palatis
Dec 12 2016 19:41
ouch
okay i'll try 32 33 25 26 27 14
Me No Dev
@me-no-dev
Dec 12 2016 19:43
btw for led 16 bits is overkill :)
you would never be able to see it
8 bits per color is more than enough
Victor Tseng
@Palatis
Dec 12 2016 19:44
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3ffc0008,len:0
load:0x3ffc0008,len:1388
load:0x40078000,len:3608
load:0x40080000,len:260
entry 0x40080034
Setting up chan 0 with 1220 hz
Setting up chan 1 with 1220 hz
Setting up chan 2 with 1220 hz
Setting up chan 3 with 1220 hz
Setting up chan 4 with 1220 hz
Setting up chan 5 with 1220 hz
Me No Dev
@me-no-dev
Dec 12 2016 19:44
so you might like sigmadelta better
Victor Tseng
@Palatis
Dec 12 2016 19:44
looks like it's ok up to 1220hz
Me No Dev
@me-no-dev
Dec 12 2016 19:44
yup
Victor Tseng
@Palatis
Dec 12 2016 19:45
i want to do brightness correction
Me No Dev
@me-no-dev
Dec 12 2016 19:45
so?
human eye can hardly see the difference above 8 bits
that is why most screens are 24 bit color
Victor Tseng
@Palatis
Dec 12 2016 19:45
the level is too distinguishable with low brightness
like 0 -> 1 vs 254 -> 255
you can't really tell if it's 254 or 255, but easily tell its 1 or 2.
Me No Dev
@me-no-dev
Dec 12 2016 19:47
make it 10 or 12 bit then
10 bit is easy :D
Victor Tseng
@Palatis
Dec 12 2016 19:47
but anyway i have to get them lit in the first place.
ok they actually do now, probably just the pin 34 35 prob.
Me No Dev
@me-no-dev
Dec 12 2016 19:51
:)