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.
Dependencies: mbed Servo MODSERIAL FastPWM
main.cpp@3:91b8945b659d, 2019-10-11 (annotated)
- Committer:
- AnkePost
- Date:
- Fri Oct 11 08:51:26 2019 +0000
- Revision:
- 3:91b8945b659d
- Parent:
- 2:381007cb7a70
- Child:
- 4:8ae0c82c2d60
Script voor servo waarmee servo beide kanten op kan draaien
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnkePost | 0:60a8a60074a7 | 1 | #include "mbed.h" |
AnkePost | 0:60a8a60074a7 | 2 | #include "Servo.h" |
AnkePost | 3:91b8945b659d | 3 | |
AnkePost | 0:60a8a60074a7 | 4 | Serial pc(USBTX, USBRX); |
AnkePost | 3:91b8945b659d | 5 | Servo myservo(D5); |
AnkePost | 3:91b8945b659d | 6 | |
AnkePost | 3:91b8945b659d | 7 | int main() |
AnkePost | 3:91b8945b659d | 8 | { |
AnkePost | 3:91b8945b659d | 9 | while(1) { |
AnkePost | 3:91b8945b659d | 10 | for(int i=0; i<100; i++) { |
AnkePost | 3:91b8945b659d | 11 | myservo = i/100.0; |
AnkePost | 3:91b8945b659d | 12 | wait(0.01); |
AnkePost | 3:91b8945b659d | 13 | pc.printf("Naar voren"); |
AnkePost | 3:91b8945b659d | 14 | } |
AnkePost | 3:91b8945b659d | 15 | for(int i=100; i>0; i--) { |
AnkePost | 3:91b8945b659d | 16 | myservo = i/100.0; |
AnkePost | 3:91b8945b659d | 17 | wait(0.01); |
AnkePost | 3:91b8945b659d | 18 | pc.printf("Naar achteren"); |
AnkePost | 3:91b8945b659d | 19 | } |
AnkePost | 0:60a8a60074a7 | 20 | } |
AnkePost | 0:60a8a60074a7 | 21 | } |