flapping wing
/
Nucleo_Servo_sample
Servo demo for Nucleo F303K8
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "Servo.h" 00003 00004 int main() 00005 { 00006 Servo myservo(D1); // Create the servo object 00007 AnalogIn knob(D3); // Create the analog input object 00008 00009 float val; 00010 00011 myservo.calibrate(0.00095, 90.0); // Calibrate the servo 00012 00013 while(1) 00014 { 00015 val = knob.read(); // Reads the value of the potentiometer (value between 0 and 1) 00016 myservo.write(val); // Sets the servo position according to the scaled value (0-1) 00017 wait_ms(15); // Waits for the servo to get there 00018 } 00019 }
Generated on Thu Jul 21 2022 14:14:02 by 1.7.2