Dlloydev / ESP32-ESP32S2-AnalogWrite

ESP32 PWM, Servo, Easing and Tone. Smart GPIO pin management and advanced control features.
MIT License
100 stars 17 forks source link

Compiling Error #35

Closed phoge110 closed 1 year ago

phoge110 commented 1 year ago

Hello.

I am getting a compiling error when trying to write a simple program while including pwmWrite.h.

#include <pwmWrite.h>
#include <Arduino.h>

uint8_t tonePin = 4;
uint8_t potPin = 12;
uint16_t duration = 500;  // tone duration ms
uint16_t interval = 0;    // pause between tones ms
uint16_t state = 0;

Pwm pwm = Pwm();  // constructor

void setup() {
  pinMode(potPin, INPUT); // sliding pot input
}

void loop() {
  // PWM signal 1000HZ for 50ms long
  // pwm.tone(tonePin, 1000, 50);  // auto attaches to ch 0
  delay(5000);
}
\Documents\Arduino\libraries\Common\pwmWrite.cpp: In member function 'void Pwm::tone(uint8_t, uint32_t, uint16_t, uint16_t)':
\Documents\Arduino\libraries\Common\pwmWrite.cpp:85:62: error: 'ledcChangeFrequency' was not declared in this scope
         ledcChangeFrequency(ch, frequency, mem[ch].resolution);
                                                              ^
\Documents\Arduino\libraries\Common\pwmWrite.cpp: In member function 'void Pwm::ledc_attach_with_invert(uint8_t, uint8_t)':
\Documents\Arduino\libraries\Common\pwmWrite.cpp:308:3: error: 'ledc_channel_config_t' has no non-static data member named 'flags'
   };
   ^

exit status 1

Compilation error: exit status 1

Is there a library or something that I am missing? Should I be using PlatformIO? I am using the ESP-32 and Arduino IDE 2.1.0.

Dlloydev commented 1 year ago

You'll just need to update the Arduino Core for ESP32. (its now at version 2.0.9)

Dlloydev commented 1 year ago

Updated readme.md to show compatible releases of Arduino Core for ESP32.