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
Fork of Robotics_Lab_DCMotor by
Revision 10:7954ec17021d, committed 2016-04-14
- Comitter:
- ChangYuHsuan
- Date:
- Thu Apr 14 16:50:02 2016 +0000
- Parent:
- 6:da43b63ffb24
- Commit message:
- yu hsuan;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 14 09:29:00 2016 +0000
+++ b/main.cpp Thu Apr 14 16:50:02 2016 +0000
@@ -38,7 +38,7 @@
char speedCmd;
-int8_t stateA_1=0, stateB_1=0, stateA_2=0, stateB_2=0;
+int8_t stateA_1 = 0, stateB_1 = 0, stateA_2 = 0, stateB_2 = 0;
int8_t state_1 = 0, state_1_old = 0, state_2 = 0, state_2_old = 0;
int v1Count = 0;
@@ -67,34 +67,34 @@
if (speedCmd == 'a')
{
- v1_ref = v1_ref + 10;
- v2_ref = v2_ref + 10;
+ v1_ref = v1_ref + 10.0f;
+ v2_ref = v2_ref + 10.0f;
}
else if (speedCmd == 's')
{
- v1_ref = v1_ref - 10;
- v2_ref = v2_ref - 10;
+ v1_ref = v1_ref - 10.0f;
+ v2_ref = v2_ref - 10.0f;
}
else if (speedCmd == 'q')
{
- v1_ref = v1_ref + 20;
- v2_ref = v2_ref + 20;
+ v1_ref = v1_ref + 20.0f;
+ v2_ref = v2_ref + 20.0f;
}
else if (speedCmd == 'w')
{
- v1_ref = v1_ref - 20;
- v2_ref = v2_ref - 20;
+ v1_ref = v1_ref - 20.0f;
+ v2_ref = v2_ref - 20.0f;
}
- if (v1_ref < -100)
- v1_ref = -100;
- else if (v1_ref > 100)
- v1_ref = 100;
+ if (v1_ref < -100.0f)
+ v1_ref = -100.0f;
+ else if (v1_ref > 100.0f)
+ v1_ref = 100.0f;
- if (v2_ref < -100)
- v2_ref = -100;
- else if (v2_ref > 100)
- v2_ref = 100;
+ if (v2_ref < -100.0f)
+ v2_ref = -100.0f;
+ else if (v2_ref > 100.0f)
+ v2_ref = 100.0f;
}
}
}
