Hello all,
I am doing a project where I have to program arduino using a program which wont use avrdude or similar things(if there is any) as backend.I am writing a script in python which would for starters connect to arduino serial port,reset the chip by toggling DTR then send the GET_SYNC command and read back the response.But it seems its not doing that...I am posting the python code here if there is something wrong happening there.I am using arduino UNO(atmega328p)
import serial
import threading
import sys
from time import sleep
def ser_rd(sp):
while True:
try:
a=sp.read()
handle_it(a)
except:
pass
def handle_it(dt):
print int(dt)
ser=serial.Serial("COM14",115200,writeTimeout=0)
thrd=threading.Thread(target=ser_rd,args=(ser,))
thrd.start()
ser.setDTR(True)
sleep(0.00001)
ser.setDTR(False)
sleep(0.0001)
ser.write(chr(0x30))
ser.write(chr(0x20))
sleep(50)
ser.close()
quit()