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@3:ad5160b8ebb5, 2018-11-27 (annotated)
- Committer:
- Van1lla
- Date:
- Tue Nov 27 10:36:23 2018 +0000
- Revision:
- 3:ad5160b8ebb5
- Parent:
- 2:fbe80f505ced
olum mit polum;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| stefan1691 | 1:32f0eb92121b | 1 | /** Servo am Digital Pin D9. |
| stefan1691 | 1:32f0eb92121b | 2 | Das orange Kabel (Signal) ist links. |
| marcel1691 | 0:e6f25efb6af9 | 3 | */ |
| marcel1691 | 0:e6f25efb6af9 | 4 | #include "mbed.h" |
| marcel1691 | 0:e6f25efb6af9 | 5 | #include "Servo.h" |
| marcel1691 | 0:e6f25efb6af9 | 6 | |
| stefan1691 | 1:32f0eb92121b | 7 | Servo servo( D9 ); |
| marcel1691 | 0:e6f25efb6af9 | 8 | |
| marcel1691 | 0:e6f25efb6af9 | 9 | int main() |
| marcel1691 | 0:e6f25efb6af9 | 10 | { |
| stefan1691 | 2:fbe80f505ced | 11 | // Servo kalibrieren, damit er die vollen 180° verwendet. |
| Van1lla | 3:ad5160b8ebb5 | 12 | servo.calibrate ( 0.0009, 360.0); |
| stefan1691 | 2:fbe80f505ced | 13 | |
| Van1lla | 3:ad5160b8ebb5 | 14 | while ( 0 ) |
| marcel1691 | 0:e6f25efb6af9 | 15 | { |
| marcel1691 | 0:e6f25efb6af9 | 16 | // Servo langsam bewegen (immer in der Mitte Anfangen mit Tests, sonst besteht die Gefahr von Schäden) |
| Van1lla | 3:ad5160b8ebb5 | 17 | for ( float p = 0.9f; p <= 1.8f; p += 0.1f ) |
| marcel1691 | 0:e6f25efb6af9 | 18 | { |
| marcel1691 | 0:e6f25efb6af9 | 19 | servo = p; |
| Van1lla | 3:ad5160b8ebb5 | 20 | wait(0.00001); |
| marcel1691 | 0:e6f25efb6af9 | 21 | } |
| Van1lla | 3:ad5160b8ebb5 | 22 | wait( 0.5 ); |
| marcel1691 | 0:e6f25efb6af9 | 23 | // und die andere Seite |
| Van1lla | 3:ad5160b8ebb5 | 24 | for ( float p = 1.8f; p >= 1.2f; p -= 1.1f ) |
| marcel1691 | 0:e6f25efb6af9 | 25 | { |
| marcel1691 | 0:e6f25efb6af9 | 26 | servo = p; |
| marcel1691 | 0:e6f25efb6af9 | 27 | wait(0.001); |
| marcel1691 | 0:e6f25efb6af9 | 28 | } |
| Van1lla | 3:ad5160b8ebb5 | 29 | wait( 0.5 ); |
| marcel1691 | 0:e6f25efb6af9 | 30 | } |
| marcel1691 | 0:e6f25efb6af9 | 31 | } |
| marcel1691 | 0:e6f25efb6af9 | 32 |