![](/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: MotorMove.cpp
- Revision:
- 10:ef379cbc0004
- Parent:
- 9:b58e7d72a91c
- Child:
- 11:80b6c5d77073
diff -r b58e7d72a91c -r ef379cbc0004 MotorMove.cpp --- a/MotorMove.cpp Mon Oct 02 19:12:02 2017 +0000 +++ b/MotorMove.cpp Mon Oct 02 19:38:45 2017 +0000 @@ -69,7 +69,51 @@ flag_down_stopping=1; //bflag_down=0; } - + + + if (bflag_up==1 && bflag_upped==0) + { + if (accel_count<(ACCEL_SIZE-1)) + { + speed = vol_accel[accel_count]; + accel_count++; + } + else + { + speed = vol_accel[ACCEL_SIZE-1]; + } + } + else if(bflag_up==1 && bflag_upped==1) + { + speed=vol_decel[0]; + bflag_up=0; + } + else if (bflag_down==1 && bflag_downed==0) + { + if (accel_count<(ACCEL_SIZE-1)) + { + speed = vol_accel[accel_count]; + accel_count++; + } + else + { + speed = vol_accel[ACCEL_SIZE-1]; + } + } + else if(bflag_down==1 && bflag_downed==1) + { + speed=vol_decel[0]; + bflag_down=0; + } + + + + else + { + speed=0; + } + + /* if (bflag_up==1) { if (flag_up_stopping==0) @@ -132,6 +176,7 @@ { speed=0; } + */ //move motor before push stopping switch