Skip to content

Commit

Permalink
Added debug message for the port
Browse files Browse the repository at this point in the history
  • Loading branch information
berndporr committed Dec 20, 2022
1 parent 976a521 commit d11f5c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/realtime_1kHz_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self,layout,title):
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.update)
self.timer.start(100)

def update(self):
self.data=self.data[-500:]
if self.data:
Expand Down Expand Up @@ -67,7 +67,7 @@ def callBack(data):
qtPanningPlot1.addData(data)

# Get the Ardunio board.
board = Arduino(PORT)
board = Arduino(PORT,debug=True)

# Set the sampling rate in the Arduino
board.samplingOn(1000 / samplingRate)
Expand Down
4 changes: 3 additions & 1 deletion pyfirmata2/pyfirmata2.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Board(object):
_parsing_sysex = False
AUTODETECT = None

def __init__(self, port, layout=None, baudrate=57600, name=None, timeout=None):
def __init__(self, port, layout=None, baudrate=57600, name=None, timeout=None, debug=False):
if port == self.AUTODETECT:
l = serial.tools.list_ports.comports()
if l:
Expand All @@ -115,6 +115,8 @@ def __init__(self, port, layout=None, baudrate=57600, name=None, timeout=None):
self.samplerThread = None
self.sp = None
raise Exception('Could not find a serial port.')
if debug:
print("Port=",port)
self.samplerThread = Iterator(self)
self.sp = serial.Serial(port, baudrate, timeout=timeout)
# Allow 5 secs for Arduino's auto-reset to happen
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='pyFirmata2',
version='2.4.3',
version='2.4.4',
description="Use your Arduino as a data acquisition card under Python",
long_description=long_description,
author='Bernd Porr',
Expand Down

0 comments on commit d11f5c1

Please sign in to comment.