new library MKII
This commit is contained in:
parent
462dbb3db4
commit
c889e6a8ec
2 changed files with 2 additions and 4 deletions
|
@ -1167,11 +1167,9 @@ uint8_t CodeRacerMKII::drive_left_speed() {
|
||||||
|
|
||||||
void CodeRacerMKII::_analog_write(uint8_t pin, uint8_t speed) {
|
void CodeRacerMKII::_analog_write(uint8_t pin, uint8_t speed) {
|
||||||
if (pin == _drive_left_enable_pin) {
|
if (pin == _drive_left_enable_pin) {
|
||||||
//_drive_left_speed = speed;
|
|
||||||
ledcWrite(DRIVE_PWM_LEFT_CHANNEL, speed);
|
ledcWrite(DRIVE_PWM_LEFT_CHANNEL, speed);
|
||||||
}
|
}
|
||||||
if (pin == _drive_right_enable_pin) {
|
if (pin == _drive_right_enable_pin) {
|
||||||
//_drive_right_speed = speed;
|
|
||||||
ledcWrite(DRIVE_PWM_RIGHT_CHANNEL, speed);
|
ledcWrite(DRIVE_PWM_RIGHT_CHANNEL, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,14 +49,14 @@ void loop() {
|
||||||
iAbstand= coderacer.usonic_measure_cm();
|
iAbstand= coderacer.usonic_measure_cm();
|
||||||
|
|
||||||
|
|
||||||
while (iAbstand<20)
|
while (iAbstand<25)
|
||||||
{
|
{
|
||||||
coderacer.drive_backward();
|
coderacer.drive_backward();
|
||||||
iAbstand= coderacer.usonic_measure_cm();
|
iAbstand= coderacer.usonic_measure_cm();
|
||||||
}
|
}
|
||||||
coderacer.stop_driving();
|
coderacer.stop_driving();
|
||||||
delay(1000);
|
delay(1000);
|
||||||
coderacer.turn_left(300);
|
coderacer.turn_left(400);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue