Hi.
I have this code to control my BLDC and ESC. Did an arduino library update and now nothing works.
[#include <ESP32Servo.h> // ESP32Servo library installed by Library Manager
#include "ESC.h" // RC_ESP library installed by Library Manager
#define ESC_PIN 26 // connected to ESC control wire
#define LED_BUILTIN 2 // not defaulted properly for ESP32s/you must define it
ESC myESC (ESC_PIN, 1000, 2000, 500); // ESC_Name (PIN, Minimum Value, Maximum Value, Arm Value)
void setup() {
pinMode(ESC_PIN, OUTPUT);
myESC.arm();
delay(1000);
myESC.speed(1000);
delay(2000);
}
void loop() {
myESC.speed(1000); // Stop the main motor
delay(2000);
myESC.speed(1250); // Stop the main motor
delay(5000);
}][/code]
It previously worked based on the post "Driving a brushless motor with an ESC from a ESP32" and i've updated the Arduino IDE with RC_ESC and ES032Servo.h and the ESC.h update of Servo.h to #include <ESP32Servo.h>,
but still get these errors now:
[WARNING: library RC_ESC claims to run on avr architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp: In destructor 'virtual ESP32PWM::~ESP32PWM()':
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:53:17: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'?
53 | ledcDetachPin(pin);
| ^~~~~~~~~~~~~
| ledcDetach
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp: In static member function 'static double ESP32PWM::_ledcSetupTimerFreq(uint8_t, double, uint8_t)':
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:60:16: error: 'ledcSetup' was not declared in this scope
60 | return ledcSetup(chan, freq, bit_num);
| ^~~~~~~~~
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp: In member function 'double ESP32PWM::setup(double, uint8_t)':
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:150:17: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'?
150 | ledcDetachPin(pin);
| ^~~~~~~~~~~~~
| ledcDetach
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:151:30: error: 'ledcSetup' was not declared in this scope
151 | double val = ledcSetup(getChannel(), freq, resolution_bits);
| ^~~~~~~~~
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:155:16: error: 'ledcSetup' was not declared in this scope
155 | return ledcSetup(getChannel(), freq, resolution_bits);
| ^~~~~~~~~
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp: In member function 'void ESP32PWM::adjustFrequencyLocal(double, double)':
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:172:17: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'?
172 | ledcDetachPin(pin);
| ^~~~~~~~~~~~~
| ledcDetach
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:176:17: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
176 | ledcAttachPin(pin, getChannel()); // re-attach the pin after frequency adjust
| ^~~~~~~~~~~~~
| ledcAttach
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp: In member function 'void ESP32PWM::attachPin(uint8_t)':
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:237:17: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
237 | ledcAttachPin(pin, getChannel());
| ^~~~~~~~~~~~~
| ledcAttach
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp: In member function 'void ESP32PWM::detachPin(int)':
c:\Users\kraus\OneDrive\Documents\Arduino\libraries\ESP32Servo\src\ESP32PWM.cpp:264:9: error: 'ledcDetachPin' was not declared in this scope; did you mean 'ledcDetach'?
264 | ledcDetachPin(pin);
| ^~~~~~~~~~~~~
| ledcDetach
exit status 1
Compilation error: exit status 1][/quote]
Can you please help me. Thanks.
ESP32 using ESC to control of BLDC via Arduino IDE
-
- Posts: 1
- Joined: Sat Jun 01, 2024 8:34 am
Who is online
Users browsing this forum: Bing [Bot] and 95 guests