-
-
Save vishalseshagiri/0057c3cea5859e5b0dad to your computer and use it in GitHub Desktop.
Revisions
-
eraclitux revised this gist
May 1, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- """ Sample code to test Arduino to Python serial communication """ import serial -
eraclitux revised this gist
May 1, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- """ Simple code to test Arduino to Python serial communication """ import serial -
eraclitux revised this gist
Apr 29, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ def mainloop(): try: #Create a connection with Arduino board and set 1 sec timeout conn = serial.Serial('/dev/ttyUSB0', timeout=1) tbytes = raw_input('Write something (exit does what you think): ') + '\n' if tbytes == 'exit\n' : break conn.write(tbytes) -
eraclitux revised this gist
Apr 29, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,8 +12,8 @@ def mainloop(): while True: try: try: #Create a connection with Arduino board and set 1 sec timeout conn = serial.Serial('/dev/ttyUSB0', timeout=1) tbytes = raw_input('Write something (exit does what youthink): ') + '\n' if tbytes == 'exit\n' : break -
eraclitux revised this gist
Apr 29, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,11 +14,11 @@ def mainloop(): try: conn = serial.Serial('/dev/ttyUSB0', timeout=1) #Create a connection with Arduino board and set 1 sec timeout tbytes = raw_input('Write something (exit does what youthink): ') + '\n' if tbytes == 'exit\n' : break conn.write(tbytes) print '\n' + 'Arduino received: ' + conn.readline() except serial.SerialException: raw_input(error_message) break -
eraclitux created this gist
Apr 29, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ #!/usr/bin/python # -*- coding: utf-8 -*- """ Simple code to test Arduino<--->Python serial communication """ import serial error_message="################ !!! Communication Error !!! ################\n" def mainloop(): while True: try: try: conn = serial.Serial('/dev/ttyUSB0', timeout=1) #Create a connection with Arduino board and set 1 sec timeout tbytes = raw_input('Scrivi qualcosa (exit per terminare): ') + '\n' if tbytes == 'exit\n' : break conn.write(tbytes) print '\n' + 'Arduino ha ricevuto i seguenti caratteri: ' + conn.readline() except serial.SerialException: raw_input(error_message) break except KeyboardInterrupt: conn.close() break if __name__ == '__main__': mainloop()