Añadido giro

parent a434fd4e
Showing with 22 additions and 0 deletions
class Robot:
def __init__(self,robot,ev3,giroSensor,colorSensor):
self.robot = robot
self.ev3 = ev3
self.giroSensor = giroSensor
self.colorSensor = colorSensor
#Metodo para el giro
def giro(grados):
robot.reset()
giroSensor.reset_angle(0)
robot.turn(grados)
while(giroSensor.angle() != grados):
diferencia = giroSensor.angle() - grados
ajuste = diferencia * -1
for i in range(abs(ajuste)):
if(ajuste > 0):
robot.turn(1)
else:
if (ajuste < 0):
robot.turn(-1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment