Robotics Club Tabletop Challenge 3

Here’s the code from our last meeting, a currently incomplete tabletop robot that currently only locates the tissue box.

————————————————-

void goForward (){
startMotor (wheelr, 90);
startMotor (wheell, 70);
}

void stopMotors(){
stopMotor (wheelr);
stopMotor (wheell);
}

void goBackwards(){
startMotor (wheell, -70);
startMotor (wheelr, -70);
}

void turnCCW(){
int motorRTurn = SensorValue(encoderr);
int motorLTurn = SensorValue(encoderl);

startMotor (wheelr, 75);
startMotor (wheell, -50);

while (SensorValue(encoderr) – motorRTurn < 365 && SensorValue(encoderl) – motorLTurn < 301)
{
}

stopMotor(wheell);
stopMotor(wheelr);
}

void turnCW(){
int motorRTurn = SensorValue(encoderr);
int motorLTurn = SensorValue(encoderl);

startMotor (wheelr, -75);
startMotor (wheell, 60);

while (SensorValue(encoderr) – motorRTurn < 395 && SensorValue(encoderl) – motorLTurn < 395)
{
}

stopMotor(wheell);
stopMotor(wheelr);
}

task main()
{
while(SensorValue(sonar)>= 20){
goForward ();
}
wait (.5);
turnCW ();
goForward ();
wait (4.9);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s