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.
Diff: MDDS30_oit.cpp
- Revision:
- 3:a64fd9b238c5
- Parent:
- 0:670c09433f11
- Child:
- 4:085a9c395959
--- a/MDDS30_oit.cpp Fri Feb 12 09:02:32 2021 +0000
+++ b/MDDS30_oit.cpp Thu Jul 22 01:06:29 2021 +0000
@@ -13,7 +13,12 @@
void MDDS30oit::lefttire(float speed){
speed=speed*63.0f;
- direction=(word2<<1)|0;
+ if(speed>0){
+ direction=(word2<<1)|0;
+ }
+ else{
+ direction=(word2<<1)|1;
+ }
leftfront=(direction<<6)|(int)speed;
md.putc(leftfront);
// r=r|31;
@@ -22,27 +27,14 @@
void MDDS30oit::righttire(float speed){
speed=speed*63.0f;
- direction=(word<<1)|0;
+ if(speed>0){
+ direction=(word<<1)|0;
+ }
+ else{
+ direction=(word<<1)|1;
+ }
rightfront=(direction<<6)|(int)speed;
- md.putc(rightfront);
+ md.putc(rightfront);
// r=r|31;
// pc.printf("%d\n",rightfront);
-}
-
-void MDDS30oit::lefttire2(float speed){
- speed=speed*63.0f;
- direction=(word2<<1)|1;
- leftback=(direction<<6)|(int)speed;
- md.putc(leftback);
-// r=r|31;
-// pc.printf("%d\n",leftback);
-}
-
-void MDDS30oit::righttire2(float speed){
- speed=speed*63.0f;
- direction=(word<<1)|1;
- rightback=(direction<<6)|(int)speed;
- md.putc(rightback);
-// r=r|31;
-// pc.printf("%d\n",rightback);
}
\ No newline at end of file