def runProgrammer(port, filename):
 programmer = Stk500v2()
 programmer.connect(port=port)
 programmer.programChip(intelHex.readHex(filename))
 programmer.close()

def runProgrammer ( port , filename ) : programmer = Stk500v2 ( ) programmer . connect ( port = port ) programmer . programChip ( intelHex . readHex ( filename ) ) programmer . close ( )
run an stk500v2 program on serial port port and write filename into flash .