ESP32 Cam dimming flash led
Posted: Tue Sep 24, 2019 5:20 pm
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.
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;
}
}