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 MODSERIAL Servo FastPWM
Revision 1:f6898c9b8c44, committed 2019-10-11
- Comitter:
- AnkePost
- Date:
- Fri Oct 11 08:35:27 2019 +0000
- Parent:
- 0:60a8a60074a7
- Child:
- 2:381007cb7a70
- Commit message:
- Niet werkende servoaansturing met stapjes van 10 procent
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 11 08:16:22 2019 +0000
+++ b/main.cpp Fri Oct 11 08:35:27 2019 +0000
@@ -1,26 +1,19 @@
+// Hello World to sweep a servo through its full range
+
#include "mbed.h"
-//#include "HIDScope.h"
-//#include "QEI.h"
-#include "MODSERIAL.h"
-//#include "BiQuad.h"
-#include "FastPWM.h"
-//#include <math.h>
#include "Servo.h"
+#include <math.h>
Serial pc(USBTX, USBRX);
-Servo servomotor(D3);
-
-int main()
-{
-
- while( true )
- {
- servomotor.write(0.2);
+Servo myservo(D5);
+
+int main()
+{
+ for(float p=0; p<1.0; p += 0.1)
+ {
+ myservo = p;
wait(0.5);
- servomotor.write(0.4);
- wait(0.5);
- pc.printf("hello");
+ pc.printf("hello!");
}
- return 0;
}
\ No newline at end of file