debugging

This commit is contained in:
shrkey
2016-10-10 20:10:15 +01:00
parent 1c5c0cfa86
commit 7fccffad14
2 changed files with 6 additions and 2 deletions

View File

@@ -232,9 +232,9 @@ void DW640::setMotorSpeed(uint8_t motor, int16_t speed) {
}
// Speed deciphering for the two control modes
if( speed >= 1000 && speed < 1500 ) {
printf( "%d - %d", speed, map(speed, 1500, 1000, 0, 255 ) );
printf( "%d - %d\n", speed, map(speed, 1500, 1000, 0, 255 ) );
} else if( speed > 1500 && speed <= 2000 ) {
printf( "%d - %d", speed, map(speed, 1500, 2000, 0, 255 ) );
printf( "%d - %d\n", speed, map(speed, 1500, 2000, 0, 255 ) );
} else if( speed > 0 && speed <= 255 ) {
runMotor( DW_FORWARD, in1, in2, speed );
} else if( speed < 0 && speed >= -255 ) {

View File

@@ -30,6 +30,10 @@ int main()
dw.setMotorSpeed( 1, 1500 );
printf("forward\n");
dw.setMotorSpeed( 1, 2000 );
dw.setMotorSpeed( 1, 1800 );
dw.setMotorSpeed( 1, 1700 );
dw.setMotorSpeed( 1, 1600 );
dw.setMotorSpeed( 1, 1550 );
usleep(5000000);
printf("stop\n");
dw.setMotorSpeed( 1, 1500 );