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@0:01afb35ba995, 2018-10-31 (annotated)
- Committer:
- s1574396
- Date:
- Wed Oct 31 11:19:11 2018 +0000
- Revision:
- 0:01afb35ba995
- Child:
- 1:9b3491c0f6b8
Lijpe beweging van de servo
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| s1574396 | 0:01afb35ba995 | 1 | #include "mbed.h" |
| s1574396 | 0:01afb35ba995 | 2 | #include "Servo.h" |
| s1574396 | 0:01afb35ba995 | 3 | |
| s1574396 | 0:01afb35ba995 | 4 | //Ticker servo; |
| s1574396 | 0:01afb35ba995 | 5 | //void signal_servo(){} |
| s1574396 | 0:01afb35ba995 | 6 | |
| s1574396 | 0:01afb35ba995 | 7 | |
| s1574396 | 0:01afb35ba995 | 8 | Servo myservo(D7); |
| s1574396 | 0:01afb35ba995 | 9 | DigitalIn but_1(SW2); |
| s1574396 | 0:01afb35ba995 | 10 | |
| s1574396 | 0:01afb35ba995 | 11 | void servocontrol() |
| s1574396 | 0:01afb35ba995 | 12 | { |
| s1574396 | 0:01afb35ba995 | 13 | if (but_1) |
| s1574396 | 0:01afb35ba995 | 14 | { |
| s1574396 | 0:01afb35ba995 | 15 | myservo = 0.1; |
| s1574396 | 0:01afb35ba995 | 16 | } |
| s1574396 | 0:01afb35ba995 | 17 | else |
| s1574396 | 0:01afb35ba995 | 18 | { |
| s1574396 | 0:01afb35ba995 | 19 | myservo = 0.0; |
| s1574396 | 0:01afb35ba995 | 20 | } |
| s1574396 | 0:01afb35ba995 | 21 | } |
| s1574396 | 0:01afb35ba995 | 22 | |
| s1574396 | 0:01afb35ba995 | 23 | int main() |
| s1574396 | 0:01afb35ba995 | 24 | { |
| s1574396 | 0:01afb35ba995 | 25 | while (1) |
| s1574396 | 0:01afb35ba995 | 26 | { |
| s1574396 | 0:01afb35ba995 | 27 | servocontrol(); |
| s1574396 | 0:01afb35ba995 | 28 | wait(0.01); |
| s1574396 | 0:01afb35ba995 | 29 | } |
| s1574396 | 0:01afb35ba995 | 30 | } |