Important update: Arm Announces End of Life Timeline for Mbed. This site will be archived in July 2026. Read the full announcement.
Servo/kr
« ServoA library for controlling a Radio Control (R/C) model Servo.
R/C Model Servo
헬로 월드!¶
Import program
00001 // Hello World to sweep a servo through its full range 00002 00003 #include "mbed.h" 00004 #include "Servo.h" 00005 00006 Servo myservo(p21); 00007 00008 int main() { 00009 for(float p=0; p<1.0; p += 0.1) { 00010 myservo = p; 00011 wait(0.2); 00012 } 00013 }
Library¶
Import library
Public Member Functions
This library controls a standard R/C model servo using a PwmOut signal, and provides control of the servo between min and max by setting it to 0.0 - 1.0.
As all servos respond differently, you can also use the calibrate function the range, so 0.0 - 1.0 is the maximum range of the servo.