RoboCatz.com

Program 4 (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()
}
/*-- The commented code below may have unbalanced parentheses.
See the coach if you need to use this code.

function lineStep()   {
	moveForward(.25)
	LSP= lightSensorPct()
	turnLeft()
	LSPleft= lightSensorPct()
	turnRight()
	turnRight()
	LSPright= lightSensorPct()
	if ( LSPleft