Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context support #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add context support #15

wants to merge 4 commits into from

Conversation

ercius
Copy link

@ercius ercius commented Jul 25, 2020

Thanks for this excellent module. Im using it to automate control of a Maestro for electron microscopy. Its very useful.

I added a feature to simplify opening and closing the USB port. Then it never stays open by accident. This is called 'context' and implements the with statement in python.

An example using context support:

with maestro.Controller(ttyStr='COM4') as servo:
        position = 6532
        servo.setSpeed(1, 10)

The USB port is closed automatically at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant