PaulStoffregen / PWMServo

Control RC Servo motors with interrupt-resilient PWM
http://www.pjrc.com/teensy/td_libs_Servo.html
25 stars 17 forks source link

PWMServo library not uploading on UnoR4 Wifi #8

Open adam-spen opened 3 months ago

adam-spen commented 3 months ago

Description

The example code Sweep using #include will not upload on a Arduino Uno R4 Wifi

Any help would be greatly appreciated. I'm trying to use the board to drive 4 ESCs for a drone

Steps To Reproduce Problem

The code will upload to a Mega 2560 but it won't run.

Hardware & Software

Mega 2560 Uno R4 Wifi

Arduino Sketch

include

include

PWMServo myservo; // create servo object to control a servo

int pos = 0; // variable to store the servo position

void setup() { pinMode(9, OUTPUT); //myservo.attach(9); // attaches the servo on pin 9 to the servo object myservo.attach(9, 1000, 2000); // some motors need min/max setting }

void loop() { for(pos = 0; pos < 180; pos += 1) { // goes from 0 degrees to 180 degrees, 1 degree steps myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for(pos = 180; pos>=1; pos-=1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } }

Errors or Incorrect Output

C:\Users\Asus\Documents\Arduino\libraries\PWMServo\PWMServo.cpp: In member function 'uint8_t PWMServo::attach(int, int, int)': C:\Users\Asus\Documents\Arduino\libraries\PWMServo\PWMServo.cpp:241:30: error: call of overloaded 'begin(int, int)' is ambiguous if (!pwmOut->begin(20000, 0)) { ^ In file included from C:\Users\Asus\Documents\Arduino\libraries\PWMServo\PWMServo.h:57:0, from C:\Users\Asus\Documents\Arduino\libraries\PWMServo\PWMServo.cpp:2: C:\Users\Asus\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.0\cores\arduino/pwm.h:24:10: note: candidate: bool PwmOut::begin(uint32_t, uint32_t, bool, timer_source_div_t) bool begin(uint32_t period_usec, uint32_t pulse_usec, bool raw = false, timer_source_div_t sd = TIMER_SOURCE_DIV_1); ^~~~~ C:\Users\Asus\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.0\cores\arduino/pwm.h:25:10: note: candidate: bool PwmOut::begin(float, float) bool begin(float freq_hz, float duty_perc); ^~~~~

exit status 1

Compilation error: exit status 1

otaasa commented 3 weeks ago

Same problem!! Arduino UNO R4 Wifi and with Sweep.ino program extracted from the examples. is there a solution? is something missing?

otaasa commented 3 weeks ago

There is a conflict between two of the three 'begin' functions of the pwm.h library that are called from this other library. I have changed the name of the function that has two parameters, in the files pwm.h and pwm.cpp and with that, I can continue.