RoboCatz.com

Program 2 (Fall 2019)


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

//start
function driveForward(degrees) {
	syncMotors(2,3,50);
	resetEncoder(2);
	while(encoderValue(2) 0 ) {
    //  syncMotors( 2,3, -50 );
    //  drawText(0,0,encoderValue(2));
  // }
  //  sleep(500)

    //drive foreward a little
    while( encoderValue( 2)<600 ) {
      syncMotors( 2,3, 50 );
      drawText(0,0,encoderValue(2));
    }
    
    
    //turn counter clockwise
    syncMotors( 2, 3, 60, 100 )
	gyro=gyroSensorValue()
	while(true) {
	  clearScreen()
	  drawText(10, 10, gyro- gyroSensorValue())
	  if(abs(gyro- gyroSensorValue())>75)break
	  sleep( 10 )
	}
	//go foreward
	while( encoderValue( 2)<2450 ) {
      syncMotors( 2,3, 50, 3 );
      drawText(0,0,encoderValue(2));
    }
    sleep(500)
    
    //drive backward
    while( encoderValue( 2)>0 ) {
      syncMotors( 2,3, -50 );
      drawText(0,0,encoderValue(2));
    }
  
    //sleep(2000)
    stopAllMotors();

    break 



  case 4:
    alert('wheel chair fart mission')

    //drive forword
    //hit wheel chair, and come back
    //first guess
    driveForward(3600); 
    driveBackward(5000)
	stopAllMotors()
	sleep(1000)
    break
    
case 5:
	alert('faris weel')
	driveForward(3750) 
    driveBackward(4800)
    stopAllMotors()
    break
    
  }
}


//this is not where the program is
//why are you looking back here
//dont look past here beware
//the password to being King of the world is 35###56788#####3