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@1:32f0eb92121b, 2015-03-25 (annotated)
- Committer:
- stefan1691
- Date:
- Wed Mar 25 12:03:02 2015 +0000
- Revision:
- 1:32f0eb92121b
- Parent:
- 0:e6f25efb6af9
- Child:
- 2:fbe80f505ced
ergaenzt
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 | { |
| marcel1691 | 0:e6f25efb6af9 | 11 | while ( 1 ) |
| marcel1691 | 0:e6f25efb6af9 | 12 | { |
| marcel1691 | 0:e6f25efb6af9 | 13 | // Servo langsam bewegen (immer in der Mitte Anfangen mit Tests, sonst besteht die Gefahr von Schäden) |
| marcel1691 | 0:e6f25efb6af9 | 14 | for ( float p = 0.4f; p < 0.6f; p += 0.0001f ) |
| marcel1691 | 0:e6f25efb6af9 | 15 | { |
| marcel1691 | 0:e6f25efb6af9 | 16 | servo = p; |
| marcel1691 | 0:e6f25efb6af9 | 17 | wait(0.001); |
| marcel1691 | 0:e6f25efb6af9 | 18 | } |
| marcel1691 | 0:e6f25efb6af9 | 19 | wait( 1.0 ); |
| marcel1691 | 0:e6f25efb6af9 | 20 | // und die andere Seite |
| marcel1691 | 0:e6f25efb6af9 | 21 | for ( float p = 0.6f; p >= 0.4f; p -= 0.0001f ) |
| marcel1691 | 0:e6f25efb6af9 | 22 | { |
| marcel1691 | 0:e6f25efb6af9 | 23 | servo = p; |
| marcel1691 | 0:e6f25efb6af9 | 24 | wait(0.001); |
| marcel1691 | 0:e6f25efb6af9 | 25 | } |
| marcel1691 | 0:e6f25efb6af9 | 26 | wait( 1.0 ); |
| marcel1691 | 0:e6f25efb6af9 | 27 | } |
| marcel1691 | 0:e6f25efb6af9 | 28 | } |
| marcel1691 | 0:e6f25efb6af9 | 29 |