Firmware for UT Robotex 2018 basketball robot

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
Reiko
Date:
Mon Nov 11 19:19:43 2019 +0000
Parent:
3:2f12dac1bcdf
Commit message:
Change default thrower (motor 3) pulsewidth_us from 800 to 100

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 17 05:12:24 2019 +0000
+++ b/main.cpp	Mon Nov 11 19:19:43 2019 +0000
@@ -17,7 +17,6 @@
 static const int NUMBER_OF_MOTORS = 3;
 
 PwmOut m3(M3_PWM);
-DigitalOut servo(ISO_PWM5);
 
 Motor motor0(M0_PWM, M0_DIR1, M0_DIR2, M0_ENCA, M0_ENCB);
 Motor motor1(M1_PWM, M1_DIR1, M1_DIR2, M1_ENCA, M1_ENCB);
@@ -28,9 +27,10 @@
     &motor0, &motor1, &motor2
 };
 
+DigitalOut servo(ISO_PWM5);
+
 RFManager rfModule(COM1_TX, COM1_RX);
 
-void serialInterrupt();
 void parseCommand(char *command);
 
 Ticker pidTicker;
@@ -68,7 +68,7 @@
                 motors[i]->setSpeed(0);
             }
 
-            m3.pulsewidth_us(800);
+            m3.pulsewidth_us(100);
         }
     }
 }
@@ -87,18 +87,16 @@
 }
 
 int main() {
+    pc.baud(115200);
+    
     pidTicker.attach(pidTick, 1 / PID_FREQ);
-    //serial.attach(&serialInterrupt);
 
-    //servo.period_us(20000);
-
-    m3.pulsewidth_us(800);
+    m3.pulsewidth_us(100);
     //servo.pulsewidth_us(0);
     
     // TGY-180D (KC2462 controller) has problems with higher frequency PWM.
     // 50Hz works, but would like to use higher frequency for motors.
-    // Software PWM seems to be good enough.
-    
+    // Software PWM seems to be good enough.    
     softPWMTicker.attach_us(softPWMTick, 20000);
 
     while (1) {
@@ -107,7 +105,7 @@
         }
 
         rfModule.update();
-        
+
         while (serial.readable()) {
             char c = serial.getc();