mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
These are meant to be used together, so document them in the same place along with a practical example.
12 lines
263 B
Python
12 lines
263 B
Python
from pybricks.pupdevices import Motor
|
|
from pybricks.parameters import Port
|
|
|
|
from uerrno import ENODEV
|
|
|
|
try:
|
|
my_motor = Motor(Port.A)
|
|
print("Detected a motor.")
|
|
except OSError as ex:
|
|
if ex.errno == ENODEV:
|
|
print("There is no motor this port.")
|