|
123456789101112131415161718192021 |
- from pybricks.hubs import EV3Brick
- from pybricks.ev3devices import Motor
- from pybricks.parameters import Port
- #from ev3dev2.motor import LargeMotor, OUTPUT_A, OUTPUT_B, SpeedPercent, MoveTank
-
- # Initialize the EV3 brick.
- ev3 = EV3Brick()
-
- # Initialize a motor at port B.
- test_motor = Motor(Port.B)
- #test = ev3dev2.motor.LargeMotor('/dev/ttyAMA0')
- #test.on(500)
-
- # Run the motor up to 500 degrees per second, for 2 seconds.
- test_motor.run_time(500, 2000)
-
- # Stop the motor.
- test_motor.stop()
-
- # Beep to indicate that the program has finished.
- ev3.speaker.beep()
|