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.
main.cpp
- Committer:
- stefan1691
- Date:
- 2015-05-20
- Revision:
- 2:fbe80f505ced
- Parent:
- 1:32f0eb92121b
- Child:
- 3:ad5160b8ebb5
File content as of revision 2:fbe80f505ced:
/** Servo am Digital Pin D9.
Das orange Kabel (Signal) ist links.
*/
#include "mbed.h"
#include "Servo.h"
Servo servo( D9 );
int main()
{
// Servo kalibrieren, damit er die vollen 180° verwendet.
servo.calibrate ( 0.0009, 180.0);
while ( 1 )
{
// Servo langsam bewegen (immer in der Mitte Anfangen mit Tests, sonst besteht die Gefahr von Schäden)
for ( float p = 0.2f; p <= 0.8f; p += 0.0001f )
{
servo = p;
wait(0.001);
}
wait( 1.0 );
// und die andere Seite
for ( float p = 0.8f; p >= 0.2f; p -= 0.0001f )
{
servo = p;
wait(0.001);
}
wait( 1.0 );
}
}