Open ghiathkamel opened 9 months ago
GPT4 told me:
To fix your warning, you need to replace the float parameter with a chrono duration in your code. > For example, instead of writing:
timeout.attach(mbed::callback(this, &ServoImpl::toggle), duration / 1e6);
You should write:
timeout.attach(mbed::callback(this, &ServoImpl::toggle), duration * 1us);
This will make your code more precise and compatible with future versions of Mbed OS.
But after editing Servo.cpp
I got new errors.
Hi @ghiathkamel. Thanks for submitting this issue.
I got these errors when compiling the code
It is important to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings, not errors. In order to avoid confusion, we should be careful to use the appropriate terminology when communicating about technical subjects.
The code in the library that causes the warnings should be fixed, and we will use this issue to track that task. However, as long as the library is functional you should not let the warnings distract you from progressing with your project.
Hi @ghiathkamel. Thanks for submitting this issue.
It is important to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings, not errors. .
Hi per1234 Thank you very much for your reply, much appreciated i got the warning in red color not white color so i thought it's error :) good to know that i can go and try the code even with these warnings msgs. please can you help me out , on Arduino H7 How can i set the servo output to 12-bit 333Hz? for 12bit output i used AnalogWriteResolution (12), and it look working but for setting the output at 333hz AnalogWriteFrequency (333) not working cuz i got errors when verifying the code, so what i need to use to get 333hz, the servo library standard output is 8bit with 50hz only, can i edit the servo.h file to get 333hz output ? but how?
please let me know! Thanks
please can you help me out , on Arduino H7 How can i set the servo output to 12-bit 333Hz?
This is not an appropriate place to request assistance with your project. You are welcome to ask over on Arduino Forum. I'm sure we'll be able to help you out over there:
https://forum.arduino.cc/c/using-arduino/programming-questions/20
to get 333Hz output i changed the servo.h file to this REFRESH_INTERVAL 3000
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
#define REFRESH_INTERVAL 3000 // minimum time to refresh servos in microseconds
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
#define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
#define INVALID_SERVO 255 // flag indicating an invalid servo index
after changing this, there is no warning messages anymore, i did not change servo.cpp file, i dont know if i need to but it works :), what do you think?
@ghiathkamel where exactly did you change it?
In my Arduino IDE 2.3.2 on Mac, if I control-click Servo.h
, it opens as read-only from /Users/razvan/Library/Arduino15/libraries/Servo/src/Servo.h
, so I don't think it uses this file. Did you recompile the Servo lib somehow manually?
Thanks! R
It looks like the Servo library is not compatible with Arduino Portenta H7 board yet.
I got these errors when compiling the code:
Additional context
Forum topic for discussion and support: https://forum.arduino.cc/t/the-servo-library-not-fully-compatible-with-arduino-h7-yet-how-can-i-fix-this-issues/1220513