Posts Tagged ARDX

Adding the ARDX.ORG source code to your Arduino Example folder

I purchased the ARDX kit from Lady Ada, and I wanted to experiment with all of the source code from the ARDX web site. However typing in the link and copying the source code didn’t automatically add it as an example. Instead I had to re-save it as a sketch. So instead, I wrote a shell script called ARDX.sh

 

This does several things.

  1. It downloads all of the sketches.
  2. It creates a directory to store all of the sketches
  3. It creates a directory for each one of the sketches.
  4. It renames the source code into a *.pde file
  5. It moves the *.pde file into the proper sketch  folder
  6. It removes all files created during the process. that are no longer needed.

To use the script, simply type

./ARDX.sh
# This creates a folder called "Ardx"
mv Ardx .../arduino-0022/examples/.

Here is the script. Note how I used the $debug variable. This let me select if I wanted to show the commands or execute the commands.

 #!/bin/sh
# Remove the '#' at the beginning of the next line to debug this script
#debug=echo
if [ ! -d Ardx ]
then
    mkdir Ardx
fi
cd Ardx
Examples="01 02 03 04 05 06 07 08 09 10 11 12A 13A"
for i in $Examples
do

    $debug wget -r http://ardx.org/CODE$i
done

$debug wget -r http://www.ardx.org/src/circ/CIRC12-code-ADAF.txt
$debug wget -r http://www.ardx.org/src/circ/CIRC13-code-ADAF.txt

# Now create a directory for each of the examples
Examples="01 02 03 04 05 06 07 08 09 10 11"
for i in $Examples
do
    if [ ! -f ardx.org/src/circ/CIRC$i-code.txt ]
    then
    echo unable to find file ardx.org/src/circ/CIRC$i-code.txt
    else
    $debug mkdir CIRC$i
    $debug mv ardx.org/src/circ/CIRC$i-code.txt CIRC$i/CIRC$i.pde
    fi
done
# Now remove the old files in 

$debug mkdir CIRC12A
$debug mv www.ardx.org/src/circ/CIRC12-code-ADAF.txt CIRC12A/CIRC12A.pde
$debug mkdir CIRC13A
$debug mv www.ardx.org/src/circ/CIRC13-code-ADAF.txt CIRC13A/CIRC13A.pde

$debug /bin/rm -r ardx.org www.ardx.org

Restart your Arduino session, and when you look in examples, you will see a new folder called Ardx. Inside is a sketch for each of the examples.

 

 

, ,

No Comments