Skip to content

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

@AnnaYoungW

Description

@AnnaYoungW

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

Activity

KooshaKayani

KooshaKayani commented on Oct 7, 2021

@KooshaKayani
#!/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)
transferred this issue fromev3dev/ev3devon Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @KooshaKayani@AnnaYoungW

        Issue actions

          How do I create a program that runs a motor forever at a specific RPM? · Issue #778 · ev3dev/ev3dev-lang-python