mostly working needs cleanup

Dependencies:   mbed

Fork of RCControlOOP by DP

Files at this revision

API Documentation at this revision

Comitter:
mfillinois
Date:
Sat Oct 11 09:30:52 2014 +0000
Parent:
5:dda15798ba1f
Commit message:
Changed L and R to upper case;

Changed in this revision

WirelessMousr.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/WirelessMousr.cpp	Thu Oct 09 13:07:37 2014 +0000
+++ b/WirelessMousr.cpp	Sat Oct 11 09:30:52 2014 +0000
@@ -1,9 +1,7 @@
 #include "WirelessMousr.h"
-#define INSTRUCTION 0
-#define VELOCITY 1
 
-//WirelessMousr::WirelessMousr() : Mousr(), pc(p28, p27) {} //USE FOR BT
-WirelessMousr::WirelessMousr() : Mousr(), pc(USBTX, USBRX) {} //USE FOR USB
+WirelessMousr::WirelessMousr() : Mousr(), pc(p28, p27) {} //USE FOR BT
+//WirelessMousr::WirelessMousr() : Mousr(), pc(USBTX, USBRX) {} //USE FOR USB
 
 int WirelessMousr::init()
 {
@@ -21,24 +19,28 @@
     int numerator;
     float denominator;
     this->pc.putc(message);
-    this->pc.putc('\n');
+    //this->pc.putc('\n');
+    //this->pc.putc('\r');
     newstate = message;
     
         
-        if ((oldstate == 'l') || (oldstate == 'r'))
+        if ((oldstate == 'L') || (oldstate == 'R'))
         {
             //this->pc.putc('V');
             
             numerator = ((int)message - 50);
             denominator =  (float) 50;
             pwmval = ((float) numerator) / denominator;
-            if (oldstate == 'l')
+            //pc.printf("%f \n \r",pwmval);
+            //pc.printf("%d",message);
+            
+            if (oldstate == 'L')
             {         
                  this->lefttire(pwmval);
                  //this->pc.putc('L');
                  //this->pc.putc('L');
             }
-            else if (oldstate == 'r')
+            else if (oldstate == 'R')
             {
                 this->righttire(pwmval);
                 //this->pc.putc('R');
@@ -51,42 +53,39 @@
                 {
                 case 'q':   //STOP
                     this->left90(); 
-                    this->pc.putc('L');
+                    /*this->pc.putc('L');
                     this->pc.putc('9');
                     this->pc.putc('0');
-                    this->pc.putc('\n');
+                    this->pc.putc('\n');*/
                     break;
                 case 'a':   //STRAIGHT
                     this->left180(); 
-                    this->pc.putc('L');
+                  /*  this->pc.putc('L');
                     this->pc.putc('8');
                     this->pc.putc('0');
-                    this->pc.putc('\n');
+                    this->pc.putc('\n');*/
                     break;
                 case 'e':   //STRAIGHT SLOW
                     this->right90(); 
-                    this->pc.putc('R');
+                 /*   this->pc.putc('R');
                     this->pc.putc('9');
                     this->pc.putc('0');
-                    this->pc.putc('\n');
+                    this->pc.putc('\n');*/
                     break;
                 case 'd':   //ROTATE LEFT MEDIUM
                     this->right180(); 
-                    this->pc.putc('R');
+             /*       this->pc.putc('R');
                     this->pc.putc('8');
                     this->pc.putc('0');
-                    this->pc.putc('\n');
+                    this->pc.putc('\n');*/
                     break;
                 case 's':   //ROTATE RIGHT MEDIUM
                   this->stop();
-                    this->pc.putc('S');
+               /*     this->pc.putc('S');
                     this->pc.putc('T');
                     this->pc.putc('P');
-                    this->pc.putc('\n'); break;
+                    this->pc.putc('\n'); break;*/
                 }
         }
-   // }
-    
     oldstate = newstate;    
-    
 }