leftTire = LargeMotor(OUTPUT_A) and LargeMotor(OUTPUT_D) #rightTire = LargeMotor(OUTPUT_D) # def getUltrasonic(): # ultrasonicSensor.mode='US-DIS-CM' # return ultrasonicSensor.units # # def getColor(): # colorSensor.mode='COL-REFLECT' # return colorSensor.value() # # # #def findObject(): # while getUltrasonic > 5.5: leftTire.run_timed(speed_sp=360, time_sp=600) #rightTire.run_timed(speed_sp = 360, time_sp = 600) time.sleep(1) leftTire.run_timed(speed_sp=360, time_sp=600) #rightTire.run_timed(speed_sp = 360, time_sp = 600) time.sleep(1) leftTire.run_timed(speed_sp=360, time_sp=600) #rightTire.run_timed(speed_sp = 360, time_sp = 600) time.sleep(1) clawMotor.run_timed(speed_sp=720, time_sp=500) time.sleep(1) leftTire.run_timed(speed_sp=360, time_sp=600) #rightTire.run_timed(speed_sp = 360, time_sp = 600) time.sleep(1)
from ev3dev.auto import OUTPUT_D, LargeMotor import time right = LargeMotor(OUTPUT_D) #move the arm down right.run_timed(speed_sp=360, time_sp=600) time.sleep(1)
from ev3dev.auto import OUTPUT_D, LargeMotor, OUTPUT_A, MediumMotor, OUTPUT_C import time mup = LargeMotor(OUTPUT_D) mgrab = MediumMotor(OUTPUT_A) mright = LargeMotor(OUTPUT_C) #move the arm down mup.run_timed(speed_sp=360, time_sp=600) #grab the object time.sleep(1) mgrab.run_timed(speed_sp=720, time_sp=500) # move arm back up time.sleep(1) mup.run_timed(speed_sp=-360, time_sp=600) #move arm right time.sleep(1) mright.run_timed(speed_sp=360, time_sp=600) #move arm down at target location time.sleep(1) mup.run_timed(speed_sp=360, time_sp=705) #release the object time.sleep(1) mgrab.run_timed(speed_sp=-360, time_sp=400) #reset position time.sleep(1) mup.run_timed(speed_sp=-360, time_sp=600) time.sleep(1) mright.run_timed(speed_sp=-360, time_sp=400)
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor, InfraredSensor from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor import time import ev3dev.auto as auto import ev3dev.ev3 as ev3 uss = UltrasonicSensor(INPUT_1) colorSensor = ColorSensor(INPUT_2) clawMotor = MediumMotor(OUTPUT_B) leftTire = LargeMotor(OUTPUT_A)# and LargeMotor(OUTPUT_D) rightTire = LargeMotor(OUTPUT_D) ev3.Sound.speak('Ha Ha Ha this is mine now').wait() leftTire.run_timed(speed_sp = 900, time_sp = 600) rightTire.run_timed(speed_sp = 900, time_sp = 600)
#!/usr/bin/python from ev3dev.auto import LargeMotor, OUTPUT_A motor = LargeMotor(OUTPUT_A) motor.duty_cycle_sp = 80 motor.time_sp = 5000 motor.run_timed() #should use speed_sp
colorSensor = ColorSensor(INPUT_2) clawMotor = MediumMotor(OUTPUT_B) leftTire = LargeMotor(OUTPUT_A) rightTire = LargeMotor(OUTPUT_D) def getUltrasonic(): ultrasonicSensor.mode = 'US-DIS-CM' return ultrasonicSensor.units def getColor(): colorSensor.mode = 'COL-REFLECT' return colorSensor.value() #def findObject(): while getUltrasonic > 5.5: leftTire.run_timed(power=15, rotations=0.2) rightTire.run_timed(power=15, rotations=0.2) time.sleep(1) clawMotor.run_timed(power=75, rotations=0.8) time.sleep(1) #def findTarget(): while getColor > 15: leftTire.run_timed(power=15, rotations=0.2) rightTire.run_timed(power=15, rotations=0.2) time.sleep(1) clawMotor.run_timed(power=75, rotations=-0.8) time.sleep(1)
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor, InfraredSensor from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor import time import ev3dev.auto as auto import ev3dev.ev3 as ev3 uss = UltrasonicSensor(INPUT_1) colorSensor = ColorSensor(INPUT_2) clawMotor = MediumMotor(OUTPUT_B) leftTire = LargeMotor(OUTPUT_A) # and LargeMotor(OUTPUT_D) rightTire = LargeMotor(OUTPUT_D) leftTire.run_timed(speed_sp=720, time_sp=600) time.sleep(1)
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor, InfraredSensor from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor import time import ev3dev.auto as auto import ev3dev.ev3 as ev3 uss = UltrasonicSensor(INPUT_1) colorSensor = ColorSensor(INPUT_2) clawMotor = MediumMotor(OUTPUT_B) leftTire = LargeMotor(OUTPUT_A) # and LargeMotor(OUTPUT_D) rightTire = LargeMotor(OUTPUT_D) rightTire.run_timed(speed_sp=720, time_sp=600) time.sleep(1) rightTire.run_timed(speed_sp=720, time_sp=600) time.sleep(1)