Use IQS62X sensor and move motor by detected angle

Dependencies:   DRV8830 IQS62x IQSDisplayTerminal UIT_ACM1602NI mbed

Fork of Nucleo_ACM1602_I2C_DC by Thinkbed

Files at this revision

API Documentation at this revision

Comitter:
8mona
Date:
Mon Oct 02 19:50:39 2017 +0000
Parent:
10:ef379cbc0004
Child:
12:8464be95bf76
Commit message:
Change parameter

Changed in this revision

MotorMove.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MotorMove.cpp	Mon Oct 02 19:38:45 2017 +0000
+++ b/MotorMove.cpp	Mon Oct 02 19:50:39 2017 +0000
@@ -6,7 +6,7 @@
 //float vol_decel_ini[DECEL_SIZE] = {1,0.75,0.4,0.15,0.05,0};
 float vol_decel_ini[DECEL_SIZE] = {-0.5,0,0,0,0,0};
 //float vol_accel_ini[ACCEL_SIZE] = {0,0.2,0.8,1,1,1};
-float vol_accel_ini[ACCEL_SIZE] = {0.2,0.4,0.6,0.8,1.0,1.0};
+float vol_accel_ini[ACCEL_SIZE] = {0.2,0.4,0.6,0.8,.9,1.0};
 
 void MotorMove::up_motor_set(int time_counter, float speed)
     {
--- a/main.cpp	Mon Oct 02 19:38:45 2017 +0000
+++ b/main.cpp	Mon Oct 02 19:50:39 2017 +0000
@@ -24,6 +24,14 @@
 #define UP_THRESHOLD    10
 #define DOWN_THRESHOLD  30
 
+#define L_UP  .95
+#define R_UP  .95
+#define L_DOWN  0.85
+#define R_DOWN  0.85
+
+
+
+
 
 Ticker timer_;
 
@@ -177,15 +185,15 @@
          if(bflag_up_pre==0&& bflag_up_cur==1)
               {
                 //shaft_speed
-                mvalL.up_motor_set(cnt, 0.9);
-                mvalR.up_motor_set(cnt, 0.9);
+                mvalL.up_motor_set(cnt, L_UP);
+                mvalR.up_motor_set(cnt, R_UP);
                 lcd_.WriteStringXY("U",0,1);
               }
               
          else if(bflag_down_pre==0 && bflag_down_cur==1)
               {
-                mvalL.down_motor_set(cnt, 1.0);
-                mvalR.down_motor_set(cnt, 1.0);
+                mvalL.down_motor_set(cnt, L_DOWN);
+                mvalR.down_motor_set(cnt, R_DOWN);
                 lcd_.WriteStringXY("D",1,1);
               } 
         else{