Skip to content

Commit

Permalink
Merge 8491fbc into 9770f5e
Browse files Browse the repository at this point in the history
  • Loading branch information
Özkan ŞEN committed Sep 23, 2020
2 parents 9770f5e + 8491fbc commit d55c16c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyfirmata/util.py
Expand Up @@ -43,17 +43,18 @@ def get_the_board(

class Iterator(threading.Thread):

def __init__(self, board):
def __init__(self, board, delay=0.01):
super(Iterator, self).__init__()
self.board = board
self.daemon = True
self.delay = delay

def run(self):
while 1:
while True:
try:
while self.board.bytes_available():
self.board.iterate()
time.sleep(0.001)
time.sleep(self.delay)
except (AttributeError, serial.SerialException, OSError):
# this way we can kill the thread by setting the board object
# to None, or when the serial port is closed by board.exit()
Expand Down

0 comments on commit d55c16c

Please sign in to comment.