Page 1 of 1

ESP32 Cam dimming flash led

Posted: Tue Sep 24, 2019 5:20 pm
by Schaggox
I'm having trouble dimming the flash led.

In my project I use multiple ESP32 cams to take a still images (1600x1200, quality set to 1) and upload them to a server.

I encountered 2 weird phenomena. 1st - The led only takes brightness values 1-4 when configured with a 8 bit int. The values 5 - 253 either are full brightness, or off.
2nd - When I try to upload a picture while the led is neither off nor value 4 (full brightness) ftp upload doesn't work.

If anybody might have a hint what to look, would really help me out.

Code: Select all

//LED setup 
int freq = 5000;
int ledCHannel = 1;
int res = 8;
const int ledPin = 4;
int brightness;

void setup()
{
ledcSetup(ledCHannel, freq, res);

ledcAttachPin(ledPin, ledCHannel);
}

void loop()
{
 
  ledcWrite(ledCHannel, brightness);
  if(go == true)
  {
      // Take picture
    if( take_picture() )
    {
      FTP_upload();
      go = false;
      return;
    }

    else
    {
      DBG("Capture failed, sleeping");
      return;
    }

  }

Re: ESP32 Cam dimming flash led

Posted: Wed Sep 25, 2019 12:02 pm
by Schaggox
Ok, i‘m an idiot. I could just turn off the flash before uploading. Sorry for the rubberducking.

Re: ESP32 Cam dimming flash led

Posted: Tue Oct 29, 2019 2:35 pm
by qqq585
Hello, Schaggox!

Could you please share with the working code of internal flash light management?
I broke my brain trying to toggle it on - in any ways, and only one way for now is to connect flash "-" contact to GND physically, with a knife... =(

Seems like GPIO4 is binded with SD-Card-slot, and it is impossible to turn the flashlight on without the SD-card... Any idea ?

Please kindly help.