-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTurnIntoAJoystick.sh
33 lines (31 loc) · 1002 Bytes
/
TurnIntoAJoystick.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 'Abracadabra! '
echo # New Line
cd ATmega8u2Code/HexFiles
if test -e dfu-programmer; then
echo "Trying to program for Arduino Uno R1/R2..."
dfu-programmer erase at90usb82
dfu-programmer at90usb82 flash UnoJoy.hex
if test $? != 0; then
echo "We didn't find the R1/R2 model, checking for an R3..."
dfu-programmer erase atmega16u2
dfu-programmer atmega16u2 flash UnoJoy.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 a joystick now!"
fi
else
echo # New Line
echo "Unplug your Arduino and plug it back in. It's a joystick now!"
fi
else
echo "Couldn't find dfu-programmer..."
echo "Did you move this script or do anything to the ATmeg8u2Code directory?"
fi