ev3dev-lang-python icon indicating copy to clipboard operation
ev3dev-lang-python copied to clipboard

How do I create a program that runs a motor forever at a specific RPM?

Open AnnaYoungW opened this issue 4 years ago • 1 comments

I tried using SpeedRPM with run_forever, but I can't figure out what the code should look like.

AnnaYoungW avatar Oct 01 '21 08:10 AnnaYoungW

#!/usr/bin/env pybricks-micropython

from pybricks.ev3devices import InfraredSensor, Motor, ColorSensor
from pybricks.parameters import Port, Button, Color, ImageFile, SoundFile, Stop
from pybricks.tools import wait
from pybricks.robotics import DriveBase
from pybricks.hubs import EV3Brick 

# Initialize the EV3 Brick.
ev3 = EV3Brick()

# Initialize the motors.
motor = Motor(Port.C)

while True:
    motor.run(speed)

KooshaKayani avatar Oct 07 '21 12:10 KooshaKayani