Last active
December 16, 2015 07:19
-
-
Save maltzsama/5397570 to your computer and use it in GitHub Desktop.
Loopback serial python script
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 characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import serial | |
| ser=serial.Serial() | |
| ser.open() | |
| ser.write('test\n') | |
| ser.close() | |
| ser2=serial.Serial('/dev/ttyS0', 19200, timeout=10) | |
| info=ser2.readline() | |
| ser2.close() | |
| if(info=='teste\n'): | |
| print 'OK' | |
| else: | |
| print 'Falha' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment