RoboCatz.com

Program 5 (Fall 2022)


The code below is a set of functions, variables, constants, and algorithms that are the work of RoboCatz for the Fall 2022 season.

currentGyro=gyroSensorValue()
gyroTarget=0


function moveForward(inches)  {
	resetEncoder(B) 
	syncMotors(B,C, 75)
	waitHereWhile  abs(encoderValue(B)) <50*inches
	//stopAllMotors()
}
function moveBackward(inches)  {
	resetEncoder(B) 
	syncMotors(B,C, -50)
	waitHereWhile  abs(encoderValue(B)) <50*inches
	//stopAllMotors()
}
function turnLeft()   {
	//resetGyroSensor()
	gyroTarget+=30
	syncMotors( B, C, 30, -100 )
	waitHereWhile  abs(gyroSensorValue()) 10
	stopAllMotors()
}
function liftWall(power){
	setMotor(A,power)
	sleep (2000)
}


function tv() {
	moveForward()
	waitHereUntil ultrasonicSensor() == 1
	stopAllMotors()
	sleep(1000)
	moveBackward(18)
}


tv()
stopAllMotors()
waitHereUntil touchSensorPressed()