Skip to content

Instantly share code, notes, and snippets.

@maltzsama
Last active December 16, 2015 07:19
Show Gist options
  • Select an option

  • Save maltzsama/5397570 to your computer and use it in GitHub Desktop.

Select an option

Save maltzsama/5397570 to your computer and use it in GitHub Desktop.
Loopback serial python script
#!/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