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:482da73abda8, committed 2011-08-11
- Comitter:
- farbodjam
- Date:
- Thu Aug 11 15:38:13 2011 +0000
- Parent:
- 0:cc4cc8826661
- Commit message:
- press u to fast , press d to slow , press h to stop
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Aug 11 15:31:32 2011 +0000
+++ b/main.cpp Thu Aug 11 15:38:13 2011 +0000
@@ -7,7 +7,7 @@
float s = 0.00;
int main() {
- pc.printf("Press 'u' to turn motor1 speed up, 'd' to turn it down\n");
+ pc.printf("Press 'u' to turn motors speed up, 'd' to turn it down and 'h' to stop\n");
while(1) {
char c = pc.getc();
if((c == 'u') && (s < 2.5)) {
@@ -18,8 +18,14 @@
}
if((c == 'd') && (s > 0.0)) {
s -= 0.01;
- A.stop(1);
- B.stop(1);
+ A.speed(s);
+ B.speed(s);
+ wait(0.02);
+ }
+ if((c == 'h') && (s > 0.0)) {
+ s -= 0.01;
+ A.stop(1);
+ B.stop(1);
wait(0.02);
}
}