Add basic controller program

This commit is contained in:
2023-10-29 20:56:03 -03:00
parent 2d782959a2
commit 11b2c845ac
2 changed files with 29 additions and 0 deletions

View File

View File

@@ -0,0 +1,29 @@
import sys
from motor_passo.motor import Motor
from motor_passo.encoder import Encoder
from motor_passo.utils import setup_cleanup, _cleanup
def main(args: list):
setup_cleanup()
motor = Motor([13, 19, 26])
motor.setup()
motor.set_speed(50)
encoder = Encoder(6, 5)
encoder.setup()
while encoder.angle <= 360:
motor.step(-5)
print(encoder.angle)
if __name__ == "__main__":
try:
main(sys.argv)
except Exception as e:
print(str(e))
finally:
_cleanup()