Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After Arduino Release v3.0.1 some lines need to be changed in example "ESP32-CAM" #141

Open
FBMinis opened this issue Jun 7, 2024 · 1 comment

Comments

@FBMinis
Copy link

FBMinis commented Jun 7, 2024

Used: F:\arduino-1.8.19\portable\packages\esp32\hardware\esp32\3.0.1\libraries\WiFi
Using library AsyncTelegram2 at version 2.3.1 in folder: F:\arduino-1.8.19\portable\sketchbook\libraries\AsyncTelegram2 
Using library ArduinoJson at version 7.0.4 in folder: F:\arduino-1.8.19\portable\sketchbook\libraries\ArduinoJson 
  1. Replace:
// Lamp Control
void setLamp(int newVal) {
  if (newVal != -1) {
    // Apply a logarithmic function to the scale.
    int brightness = round((pow(2, (1 + (newVal * 0.02))) - 2) / 6 * pwmMax);
    ledcWrite(lampChannel, brightness);
    Serial.print("Lamp: ");
    Serial.print(newVal);
    Serial.print("%, pwm = ");
    Serial.println(brightness);
  }
}

With:

// Lamp Control
void setLamp(int newVal) {
  if (newVal != -1) {
    // Apply a logarithmic function to the scale.
    int brightness = round((pow(2, (1 + (newVal * 0.02))) - 2) / 6 * pwmMax);
    ledcWrite(LAMP_PIN, brightness);
    Serial.print("Lamp: ");
    Serial.print(newVal);
    Serial.print("%, pwm = ");
    Serial.println(brightness);
  }
}
  1. Replace:
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);       // disable brownout detector
  pinMode(LAMP_PIN, OUTPUT);                       // set the lamp pin as output
  ledcSetup(lampChannel, pwmfreq, pwmresolution);  // configure LED PWM channel
  setLamp(0);                                      // set default value
  ledcAttachPin(LAMP_PIN, lampChannel);            // attach the GPIO pin to the channel

With:

 WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);       // disable brownout detector
  pinMode(LAMP_PIN, OUTPUT);                       // set the lamp pin as output
  ledcAttach(LAMP_PIN, pwmfreq, pwmresolution);  // configure LED PWM channel
  setLamp(0);                                      // set default value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant