Rename module from motor_passo to spectrometer

This commit is contained in:
2023-10-29 20:56:03 -03:00
parent 02051ebda7
commit 00633508f0
15 changed files with 11 additions and 11 deletions

View File

View File

@@ -0,0 +1,29 @@
import sys
from spectrometer.motor import Motor
from spectrometer.encoder import Encoder
from spectrometer.utils.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()

View File

View File

@@ -0,0 +1,17 @@
from spectrometer.encoder import Encoder
from spectrometer.utils.utils import setup_cleanup
from time import sleep
def main():
setup_cleanup()
encoder = Encoder(6, 5)
encoder.setup()
while True:
print(encoder.angle)
sleep(1)
if __name__ == "__main__":
main()

View File

View File

@@ -0,0 +1,17 @@
from spectrometer.motor import Motor
from spectrometer.utils.utils import setup_cleanup
def main():
setup_cleanup()
motor = Motor([13, 19, 26])
motor.setup()
motor.set_speed(10)
while True:
input()
motor.step(1)
if __name__ == "__main__":
main()