Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use port if specified.
  • Loading branch information
ianjosephwilson committed May 4, 2013
commit 6f0a41c04b9ea9543a2949fd76cfb1de38a8e06e
13 changes: 8 additions & 5 deletions Arduino/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def __init__(self,baud,port="",timeout=2):
self.timeout = timeout
self.ss_connected=False
if port == "":
self.findPort()
self.port = self.findPort()
else:
self.port = port
assert self.port
self.sr = serial.Serial(self.port, self.baud,timeout =self.timeout)
time.sleep(2)
self.SoftwareSerial = SoftwareSerial(self)
Expand All @@ -25,9 +28,9 @@ def findPort(self):
"""
for pt in list_ports.comports():
if ("FTDIBUS" in pt[-1]) or ("usbserial" in pt[-1]):
self.port = pt[0]
return
return pt[0]
return None

def digitalWrite(self,pin,val):
"""
Sends digitalWrite command
Expand Down Expand Up @@ -352,4 +355,4 @@ def read(self):
a=board.Servos.read(9)
if a == 1:
print "time",time.time() - t
break
break