mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
19 lines
523 B
Python
19 lines
523 B
Python
# This work is licensed under the MIT license.
|
|
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
|
|
# https://github.com/openmv/openmv/blob/master/LICENSE
|
|
#
|
|
# Motor Shield Stepper Motor Example
|
|
#
|
|
# This example shows off how to use your motor shield
|
|
# to control 1 stepper motor.
|
|
|
|
import time
|
|
from tb6612 import Stepper
|
|
|
|
stepper = Stepper() # default rpm=2, power=50
|
|
stepper.set_speed(1) # rpm = 1
|
|
stepper.set_power(80) # set pwm
|
|
while True:
|
|
stepper.step(200) # motor rotates 1 circle
|
|
time.sleep_ms(1000)
|