Commit 3aa7638b authored by Casper's avatar Casper
Browse files

Pushed new partyfinder

parent d9e721d9
......@@ -23,24 +23,21 @@ public class PartyFinder {
leftValue = soundSensorLeft.readRawValue();
rightValue = soundSensorRight.readRawValue();
if(leftValue < 940 && rightValue < 940) {
diff = leftValue - rightValue;
if(diff < 0) {
// Party is to right
right(75);
right(70);
}
else if(diff > 0) {
// Party is to left
left(75);
left(70);
}
else {
// Party is straight ahead ( or behind you :( )
forward(75);
}
} else {
stop();
forward(70);
}
// Debug info
LCD.drawInt(leftValue,4,0,1);
LCD.drawInt(rightValue,4,0,2);
......@@ -63,11 +60,11 @@ public class PartyFinder {
public static void left( int power)
{
leftMotor.controlMotor(power, MotorPort.FORWARD);
rightMotor.controlMotor(power / 4, MotorPort.FORWARD);
rightMotor.controlMotor(power / 3, MotorPort.FORWARD);
}
public static void right( int power)
{
leftMotor.controlMotor(power / 4, MotorPort.FORWARD);
leftMotor.controlMotor(power / 3, MotorPort.FORWARD);
rightMotor.controlMotor(power, MotorPort.FORWARD);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment