![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Servo
Dependencies: mbed MODSERIAL Servo FastPWM
main.cpp@0:60a8a60074a7, 2019-10-11 (annotated)
- Committer:
- AnkePost
- Date:
- Fri Oct 11 08:16:22 2019 +0000
- Revision:
- 0:60a8a60074a7
- Child:
- 1:f6898c9b8c44
Niet werkende versie servomotoraansturing
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 "HIDScope.h" |
AnkePost | 0:60a8a60074a7 | 3 | //#include "QEI.h" |
AnkePost | 0:60a8a60074a7 | 4 | #include "MODSERIAL.h" |
AnkePost | 0:60a8a60074a7 | 5 | //#include "BiQuad.h" |
AnkePost | 0:60a8a60074a7 | 6 | #include "FastPWM.h" |
AnkePost | 0:60a8a60074a7 | 7 | //#include <math.h> |
AnkePost | 0:60a8a60074a7 | 8 | #include "Servo.h" |
AnkePost | 0:60a8a60074a7 | 9 | |
AnkePost | 0:60a8a60074a7 | 10 | Serial pc(USBTX, USBRX); |
AnkePost | 0:60a8a60074a7 | 11 | |
AnkePost | 0:60a8a60074a7 | 12 | Servo servomotor(D3); |
AnkePost | 0:60a8a60074a7 | 13 | |
AnkePost | 0:60a8a60074a7 | 14 | int main() |
AnkePost | 0:60a8a60074a7 | 15 | { |
AnkePost | 0:60a8a60074a7 | 16 | |
AnkePost | 0:60a8a60074a7 | 17 | while( true ) |
AnkePost | 0:60a8a60074a7 | 18 | { |
AnkePost | 0:60a8a60074a7 | 19 | servomotor.write(0.2); |
AnkePost | 0:60a8a60074a7 | 20 | wait(0.5); |
AnkePost | 0:60a8a60074a7 | 21 | servomotor.write(0.4); |
AnkePost | 0:60a8a60074a7 | 22 | wait(0.5); |
AnkePost | 0:60a8a60074a7 | 23 | pc.printf("hello"); |
AnkePost | 0:60a8a60074a7 | 24 | } |
AnkePost | 0:60a8a60074a7 | 25 | return 0; |
AnkePost | 0:60a8a60074a7 | 26 | } |