Last active
November 13, 2022 18:16
-
-
Save nicinabox/cee1ced859218dc77617c82ae37b7d6e to your computer and use it in GitHub Desktop.
Find the Pro Micro serial port automatically and flash it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage | |
# ./flash.sh path/to/your.hex | |
TARGET=$1 | |
ls /dev/tty* > /tmp/1 | |
echo "Reset your Pro Micro now" | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment