def autonomous(): while True: potvalue = pot.value(RotationUnits.DEG) print(potvalue) if potvalue < 100: Motor.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.PCT) else: Motor.spin(vex.DirectionType.FWD, 40, vex.VelocityUnits.PCT) # if bumper_b.pressing() == 0: # Motor.spin(vex.DirectionType.FWD, 40, vex.VelocityUnits.PCT) # # else: # Motor.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.PCT) # sys.sleep(1) def drivercontrol(): pass competition = vex.Competition() competition.autonomous(autonomous) competition.drivercontrol(drivercontrol) # output cable connected to port C and the inpur connected to port d # output and input have to be on the consecutive ports in that order # Sonar has two three wire connection - one is termed as input and the other # as the output # print("*****end******")
import sys # import all of these! import vex from vex import * import math # you can make your own functions and classes used in the below three functions here. def pre_auton(): # place pre-auto code here pass def autonomous(): # place autonomous code here pass def drivercontrol(): # place main control code here while True: pass competition = vex.Competition() # competition object competition.autonomous(autonomous) # set up callbacks for the three periods competition.drivercontrol(drivercontrol) pre_auton()