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: Encoder MODSERIAL mbed HIDScope
Fork of frdm_Motortryout2 by
Revision 4:69c6cc1247c1, committed 2015-09-21
- Comitter:
- Margreeth95
- Date:
- Mon Sep 21 11:27:52 2015 +0000
- Parent:
- 3:051c91b04acd
- Child:
- 5:672798238952
- Commit message:
- Switch;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Sep 21 11:16:34 2015 +0000
+++ b/main.cpp Mon Sep 21 11:27:52 2015 +0000
@@ -16,16 +16,34 @@
pc.baud(9600);
while(true)
{
- if(button1 == 0)
+ char c = pc.getc();
+ switch(c)
+ {
+ case 'f':
{
motor2direction = 1;
motor2speed = 0.5f;
- pc.printf("het werkt");
+ pc.printf("het werkt\n");
wait(1);
led = 0;
wait(0.2f);
motor2speed = 0;
led = 1;
+ break;
}
+
+ case 'r':
+ {
+ motor2direction = -1;
+ motor2speed = 0.5f;
+ pc.printf("dit werkt ook\n");
+ wait(1);
+ led = 0;
+ wait(0.2f);
+ motor2speed = 0;
+ led = 1;
+ break;
+ }
+ }
}
}
\ No newline at end of file
