Skip to content

Commit

Permalink
testing handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
fmhall committed Apr 16, 2019
1 parent a0b88a9 commit cbcb8ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RaspberryPi-master/Arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def tryConnect(self):
return conn
#How the object will represent itself when called or printed
def __repr__(self):
return "Arduino object:\n\nArduino at port: %s\nspeed: %s" %(self.port,self.speed)
return "Arduino at port: %s\n" %(self.port)



13 changes: 12 additions & 1 deletion RaspberryPi-master/communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,19 @@ def setup():
continue
byte = bytes_array[0]
if byte in [Order.HELLO.value, Order.ALREADY_CONNECTED.value]:
print("Connected to Arduino" + str(ard))
print("Connected to Arduino: " + str(ard))
break
while True:
for ard in ardList:
bytes_array = bytearray(ard.conn.read(1))
if not bytes_array:
time.sleep(1)
print("no messages from ", str(ard))
continue
byte = bytes_array[0]
# byte = ser.read(1)
print("Message from " + str(ard) + ": " + byte)
time.sleep(1)

return ardList

Expand Down

0 comments on commit cbcb8ef

Please sign in to comment.