Skip to content

Instantly share code, notes, and snippets.

@hunandy14
Last active April 8, 2016 03:20
Show Gist options
  • Save hunandy14/352bd562d7152dff1e05 to your computer and use it in GitHub Desktop.
Save hunandy14/352bd562d7152dff1e05 to your computer and use it in GitHub Desktop.
RaspberryPi
import serial
import os
os.system("sudo chmod 666 /dev/ttyAMA0")
Uart = serial.Serial("/dev/ttyAMA0", baudrate = 38400, timeout = 1)
Uart.write("Pi UART is already.")
print("Pi UART is already.")
while True:
UartSTR = Uart.readline()
if len(UartSTR) > 2:
print UartSTR,
Uart.write(UartSTR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment