We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8297c32 commit fab0609Copy full SHA for fab0609
src/mbed/Servo.cpp
@@ -1,5 +1,6 @@
1
#if defined(ARDUINO_ARCH_MBED)
2
3
+#include <chrono>
4
#include <Arduino.h>
5
#include <Servo.h>
6
#include <mbed.h>
@@ -28,11 +29,11 @@ class ServoImpl {
28
29
30
void start(uint32_t duration_us) {
31
duration = duration_us;
- ticker.attach(mbed::callback(this, &ServoImpl::call), 0.02f);
32
+ ticker.attach(mbed::callback(this, &ServoImpl::call), std::chrono::microseconds(REFRESH_INTERVAL));
33
}
34
35
void call() {
- timeout.attach(mbed::callback(this, &ServoImpl::toggle), duration / 1e6);
36
+ timeout.attach(mbed::callback(this, &ServoImpl::toggle), std::chrono::microseconds(duration));
37
toggle();
38
39
0 commit comments