-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTurnIntoAnArduino.sh
33 lines (31 loc) · 1.04 KB
/
TurnIntoAnArduino.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
cd "`dirname "$0"`"
echo # New Line
echo 'Like magic. '
echo # New Line
cd ATmega8u2Code/HexFiles
if test -e dfu-programmer; then
echo "Trying to program for Arduino Uno R1/R2..."
dfu-programmer at90usb82 erase
dfu-programmer at90usb82 flash Arduino-usbserial-uno.hex
if test $? != 0; then
echo "We didn't find the R1/R2 model, checking for an R3..."
dfu-programmer atmega16u2 erase
dfu-programmer atmega16u2 flash Arduino-usbserial-uno.hex
if test $? != 0; then
echo # New line
echo "dfu-programmer couldn't connect to the Arduino..."
echo "Did you put the Arduino into DFU mode?"
echo "Did you install the libusb driver?"
else
echo # New Line
echo "Unplug your Arduino and plug it back in. It's back to being an Arduino now!"
fi
else
echo # New Line
echo "Unplug your Arduino and plug it back in. It's back to being an Arduino now!"
fi
else
echo "Couldn't find dfu-programmer..."
echo "Did you move this script or do anything to the ATmeg8u2Code directory?"
fi