Skip to content

Instantly share code, notes, and snippets.

@anthonyeden
Created June 28, 2015 08:14
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 anthonyeden/0a4becbde55bf565803f to your computer and use it in GitHub Desktop.
Save anthonyeden/0a4becbde55bf565803f to your computer and use it in GitHub Desktop.
2wcom RDS Commands via Python
import serial
def updateRDS(comPort, title, artist, duration):
serialConnection = serial.Serial(comPort)
serialConnection.write("DURATION=" + str(int(duration)) + "\n")
serialConnection.write("STRING1=Now: \n")
serialConnection.write("STRING2= by \n")
serialConnection.write("FORMAT_RT=STRING1+TITLE+STRING2+ARTIST\n")
serialConnection.write("AUTO_RT=Y\n")
serialConnection.write("AUTO_RTPLUS=Y\n")
serialConnection.write("RT_DELAY=3\n")
serialConnection.write("TITLE=" + str(title) + "\n")
serialConnection.write("ARTIST=" + str(artist) + "\n")
serialConnection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment