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

Why does the pyfirmata closes after a certain amount of time running? #113

Open
leo-smi opened this issue Sep 26, 2021 · 0 comments
Open

Comments

@leo-smi
Copy link

leo-smi commented Sep 26, 2021

I don't know the right time, but the loop just closes and no error.

I'm using arduino uno R3 (chinese clone CH340).

I think there's a problem with the threading or something like that...

The code:

from pyfirmata import Arduino, util
import time


Uno = Arduino('COM3')
pin3 = Uno.get_pin('d:3:p')

dt = 0.005
N = 255

while True:
    
    for i in range(1, N+1, 1):
        # print(i/100)
        pin3.write(i/N)
        time.sleep(dt)

    for i in range(N, 0, -1):
        # print(i/100)
        pin3.write(i/N)
        time.sleep(dt)
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

No branches or pull requests

1 participant