Permalink
Browse files

Fix some typos.

  • Loading branch information...
1 parent 182408b commit 256d4a6442c38d21d30575d4b9d3983eac2d1b15 @orlandov committed Nov 10, 2008
Showing with 5 additions and 8 deletions.
  1. +5 −8 hbridge.pde
View
@@ -69,27 +69,24 @@ bool prev_pressed = 0;
void loop() {
// read the pot
byte duty_cycle = analogRead(pot_pin) / 4;
+ analogWrite(motor0_pwm, duty_cycle);
+ analogWrite(motor1_pwm, duty_cycle);
// toggle the directions
- pressed = digitalRead(switch_pin);
+ prev_pressed = pressed;
delay(10);
+ pressed = digitalRead(switch_pin);
if (pressed
- && (pressed == digitalRead(switch_pin))
- && pressed != prev_pressed) {
+ && (prev_pressed == 0)) {
direction = !direction;
}
- else {
- analogWrite(motor0_pwm, duty_cycle);
- analogWrite(motor1_pwm, duty_cycle);
- }
if (direction) {
drive_backwards();
}
else {
drive_forwards();
}
- prev_pressed = pressed;
}

0 comments on commit 256d4a6

Please sign in to comment.