Skip to content

Instantly share code, notes, and snippets.

@nicinabox
Last active November 13, 2022 18:16
Show Gist options
  • Select an option

  • Save nicinabox/cee1ced859218dc77617c82ae37b7d6e to your computer and use it in GitHub Desktop.

Select an option

Save nicinabox/cee1ced859218dc77617c82ae37b7d6e to your computer and use it in GitHub Desktop.

Revisions

  1. nicinabox revised this gist Jan 30, 2017. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions flash.sh
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,12 @@ TARGET=$1

    ls /dev/tty* > /tmp/1

    echo "Reset your Pro Micro then hit any key to continue..."
    read -n 1 -s
    echo "Reset your Pro Micro now"

    ls /dev/tty* > /tmp/2
    USB=`diff /tmp/1 /tmp/2 | grep '>' | sed -e 's/> //'`
    while [[ -z $USB ]]; do
    sleep 1
    ls /dev/tty* > /tmp/2
    USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`
    done

    avrdude -p atmega32u4 -c avr109 -P $USB -U flash:w:$TARGET
    avrdude -p atmega32u4 -c avr109 -P $USB -U flash:w:$TARGET
  2. nicinabox created this gist Jan 26, 2017.
    16 changes: 16 additions & 0 deletions flash.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #!/bin/bash

    # Usage
    # ./flash.sh path/to/your.hex

    TARGET=$1

    ls /dev/tty* > /tmp/1

    echo "Reset your Pro Micro then hit any key to continue..."
    read -n 1 -s

    ls /dev/tty* > /tmp/2
    USB=`diff /tmp/1 /tmp/2 | grep '>' | sed -e 's/> //'`

    avrdude -p atmega32u4 -c avr109 -P $USB -U flash:w:$TARGET