Skip to content

Instantly share code, notes, and snippets.

@ElectricImpSampleCode
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElectricImpSampleCode/62e9aca93e07eb2e4cc9 to your computer and use it in GitHub Desktop.
Save ElectricImpSampleCode/62e9aca93e07eb2e4cc9 to your computer and use it in GitHub Desktop.
Raspberry Pi Python code for unattended logging
#!/usr/bin/env python
import serial
s = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=3.0)
message = ""
while True:
logChar = s.read()
if logChar:
if logChar != "\n":
message = message + logChar
else:
print(message)
message = ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment