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.
Revision 1:acd79b94fe6a, committed 2016-10-20
- Comitter:
- lisa96m
- Date:
- Thu Oct 20 10:08:47 2016 +0000
- Parent:
- 0:ebffc70ade24
- Commit message:
- Try out servo;
Changed in this revision
| Servo.lib | Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Servo.lib Thu Oct 20 07:31:33 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/users/simon/code/Servo/#36b69a7ced07
--- a/main.cpp Thu Oct 20 07:31:33 2016 +0000
+++ b/main.cpp Thu Oct 20 10:08:47 2016 +0000
@@ -5,25 +5,25 @@
Serial pc(USBTX, USBRX);
PwmOut servo(A4);
-double x = 0;
-float pi = 3.14;
-
+volatile double x = 0;
void loop()
{
double y = sin(x);
{
- x++;
+ x = x+0.2;
}
servo = abs(y);
pc.printf("grootte van sinus is %f.\r\n", abs(y));
+ pc.printf("grootte van x is %f.\r\n", x);
}
int main()
{
pc.baud(SERIAL_BAUD);
+ servo.period(0.020);
while(true) {
loop();
- wait(10);
+ wait(2);
}
}
\ No newline at end of file