Skip to content

Commit

Permalink
fixed msleep problems in ServoExample
Browse files Browse the repository at this point in the history
  • Loading branch information
trestoa committed Sep 8, 2013
1 parent 32c42f1 commit ac17d2f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/Servo/ServoExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ public static void main(String[] agrs){
AnalogSensor sensor = new AnalogSensor(0);
Servo servo = new Servo(0);
servo.enable();
Controller c = new Controller();
while(true){
System.out.println("Place sensor!");
Controller.msleep(1000);
c.msleep(1000);
int currentVal = sensor.getValue();
System.out.println(currentVal);
if(currentVal > 600){
servo.setPosition(2000);
Controller.msleep(500);
c.msleep(500);
}
else{
servo.setPosition(0);
Controller.msleep(500);
c.msleep(500);
}
servo.setPosition(1000);
Controller.msleep(500);
c.msleep(500);
}
}
}

0 comments on commit ac17d2f

Please sign in to comment.