CanSat2016aizu / Cansat2016

Dependents:   Cansat2016_v1 Cansat2016_v1

Revision:
1:dad5c9475937
Parent:
0:b42b5cb8b646
Child:
2:6fa291470764
--- a/Cansat2016.cpp	Sat Jul 23 11:08:49 2016 +0000
+++ b/Cansat2016.cpp	Wed Jul 27 11:46:36 2016 +0000
@@ -7,9 +7,9 @@
 //************************************
 Cansat2016::Cansat2016(VNH5019 motor):_motor(motor)
 {
-    
+
     distance = 500.0;
-    
+
     action = 's';
     speed = 64;
 }
@@ -22,7 +22,7 @@
     distance = sqrt(sub_x*sub_x + sub_y*sub_y);
 
     if(distance > 5.0) speed = 128;
-    else speed = 64;
+    else speed = 96;
 }
 
 // direction of robot
@@ -153,17 +153,17 @@
 
     // right turn
     if(action == 'r') {
-        _motor.changeSpeed(1, speed, 1, speed-32);
+        _motor.changeSpeed(1, speed, 1, speed-64);
     }
 
     // light turn
     if(action == 'l') {
-        _motor.changeSpeed(1, speed-32, 1, speed);
+        _motor.changeSpeed(1, speed-64, 1, speed);
     }
 
     // back
     if(action == 'b') {
-        _motor.changeSpeed(2, speed, 2, speed-32);
+        _motor.changeSpeed(2, speed, 2, speed-64);
     }
 
     // stop
@@ -172,6 +172,7 @@
     }
 }
 
+
 //*************************************
 //
 // Set
@@ -194,6 +195,11 @@
     action = a;
 }
 
+void Cansat2016::set_speed(int value)
+{
+    speed = value;
+}
+
 //****************************************
 //
 // Get