Skip to content

Instantly share code, notes, and snippets.

@robseward
Created May 9, 2016 16:13
Show Gist options
  • Save robseward/bfa7db459b38524536145b1b65106665 to your computer and use it in GitHub Desktop.
Save robseward/bfa7db459b38524536145b1b65106665 to your computer and use it in GitHub Desktop.
Running this script with a port name as an argument will restart an Arduino attached to that port
import serial
import sys
import time
portname = sys.argv[1]
ser = serial.Serial('/dev/' + portname, 230400)
def reset_arduino():
ser.setDTR(0)
time.sleep(0.22)
ser.setDTR(1)
if __name__ == "__main__":
reset_arduino()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment