18 lines
575 B
Python
18 lines
575 B
Python
from pybricks.pupdevices import Motor
|
|
from pybricks.parameters import Button, Direction, Port, Side, Stop
|
|
from pybricks.tools import run_task, multitask
|
|
from pybricks.tools import wait, StopWatch
|
|
from pybricks.robotics import DriveBase
|
|
from pybricks.iodevices import XboxController
|
|
from pybricks.hubs import PrimeHub
|
|
hub = PrimeHub()
|
|
testmotor = Motor(Port.C)
|
|
async def main():
|
|
while True:
|
|
if(Button.UP in buttons.pressed()):
|
|
testmotor.run(500)
|
|
else:
|
|
testmotor.stop()
|
|
await wait(10)
|
|
# Run the main function
|
|
run_task(main()) |