![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Use IQS62X sensor and move motor by detected angle
Dependencies: DRV8830 IQS62x IQSDisplayTerminal UIT_ACM1602NI mbed
Fork of Nucleo_ACM1602_I2C_DC by
Diff: main.cpp
- Revision:
- 11:80b6c5d77073
- Parent:
- 10:ef379cbc0004
- Child:
- 12:8464be95bf76
--- 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{