Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Nucleo_ServoKnob by
main.cpp
- Committer:
- jose_23991
- Date:
- 2014-09-19
- Revision:
- 0:3a3bfe92df7c
- Child:
- 1:f66f012c59de
File content as of revision 0:3a3bfe92df7c:
#include "mbed.h" #include "Servo.h" int main() { Servo myservo(D3); // Create the servo object AnalogIn knob(A0); // Create the analog input object float val; myservo.calibrate(0.00095, 90.0); // Calibrate the servo while(1) { val = knob.read(); // Reads the value of the potentiometer (value between 0 and 1) myservo.write(val); // Sets the servo position according to the scaled value (0-1) wait_ms(15); // Waits for the servo to get there } }