Last active
August 29, 2015 14:15
-
-
Save ElectricImpSampleCode/62e9aca93e07eb2e4cc9 to your computer and use it in GitHub Desktop.
Raspberry Pi Python code for unattended logging
This file contains 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 | |
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