Skip to main content
deleted 5 characters in body
Source Link

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide usually uses.

from serial import Serial
from time import sleep
from subprocess import run

while input('Press enter to upload ') == '':
    Serial('COM5',baudrate=1200).close()
    sleep(1)
    run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\Hedengren\\Desktop\\Python\\tclab_v2\\Users\\USER\\Desktop\\Python\\tclab_v2/tclab_v2.ino.hex:i"])

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

from serial import Serial
from time import sleep
from subprocess import run

while input('Press enter to upload ') == '':
    Serial('COM5',baudrate=1200).close()
    sleep(1)
    run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\Hedengren\\Desktop\\Python\\tclab_v2/tclab_v2.ino.hex:i"])

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide usually uses.

from serial import Serial
from time import sleep
from subprocess import run

while input('Press enter to upload ') == '':
    Serial('COM5',baudrate=1200).close()
    sleep(1)
    run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\USER\\Desktop\\Python\\tclab_v2/tclab_v2.ino.hex:i"])
deleted 65 characters in body
Source Link

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

importfrom serial
  import timeSerial
from time import subprocess
sleep
ifrom =subprocess 'r'import run

while iinput('Press enter to upload ') == 'r''':
    ser = serial.Serial('COM5',baudrate=1200)
    print(ser.isOpen()); ser.close()
    time.sleep(21)
    subprocess.run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\HEDENG~1\\AppData\\Local\\Temp\\arduino_build_116383\\Users\\Hedengren\\Desktop\\Python\\tclab_v2/tclab_v2.ino.hex:i"])
    i = input('r to repeat')

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

import serial
 import time
import subprocess

i = 'r'
while i == 'r':
    ser = serial.Serial('COM5',baudrate=1200)
    print(ser.isOpen()); ser.close()
    time.sleep(2)
    subprocess.run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\HEDENG~1\\AppData\\Local\\Temp\\arduino_build_116383/tclab_v2.ino.hex:i"])
    i = input('r to repeat')

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

from serial import Serial
from time import sleep
from subprocess import run

while input('Press enter to upload ') == '':
    Serial('COM5',baudrate=1200).close()
    sleep(1)
    run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\Hedengren\\Desktop\\Python\\tclab_v2/tclab_v2.ino.hex:i"])
deleted 38 characters in body
Source Link

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

import serial
import time
import subprocess

#i open= and'r'
while closei a== port'r':
 to activate bootloader
 ser = serial.Serial('COM5',baudrate=1200)
    print(ser.isOpen()); ser.close()
    time.sleep(2)

i = 'r'
while i == 'r':
    subprocess.run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\HEDENG~1\\AppData\\Local\\Temp\\arduino_build_116383/tclab_v2.ino.hex:i"])
    i = input('r to repeat')

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

import serial
import time
import subprocess

# open and close a port to activate bootloader
ser = serial.Serial('COM5',baudrate=1200)
print(ser.isOpen()); ser.close()
time.sleep(2)

i = 'r'
while i == 'r':
    subprocess.run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\HEDENG~1\\AppData\\Local\\Temp\\arduino_build_116383/tclab_v2.ino.hex:i"])
    i = input('r to repeat')

This isn't the exact answer but it helps.

Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide uses.

import serial
import time
import subprocess

i = 'r'
while i == 'r':
    ser = serial.Serial('COM5',baudrate=1200)
    print(ser.isOpen()); ser.close()
    time.sleep(2)
    subprocess.run(["C:\\Progra~2\\Arduino\\hardware\\tools\\avr/bin/avrdude", "-CC:\\Progra~2\\Arduino\\hardware\\tools\\avr/etc/avrdude.conf", "-v", "-patmega32u4", "-cavr109", "-PCOM6", "-b57600", "-D", "-Uflash:w:C:\\Users\\HEDENG~1\\AppData\\Local\\Temp\\arduino_build_116383/tclab_v2.ino.hex:i"])
    i = input('r to repeat')
Source Link
Loading