Version 7

    element14's The Ben Heck Show

    Join the Ben Heck team every week for amazing hacks! Watch them build and mod community-inspired projects using electronics!

    Back to The Ben Heck Show homepage

    sudo Sergeant
    Featured Bonus Content
    See All Episodes

     

     

    The Arduino Development Environment is cross platform which is another way of saying that its available for Linux. What you might not be aware of is that you're not locked down to it, not even on Linux. If you're like Felix, you may find the Arduino Development Environment to clunky for your taste.  sudo Sergeant shows you how you can sidestep the Arduino Development Environment, and code the way you want to!

     

     

    Felix Exclusive:  Arduino Development Environment Alternatives . . .

     

     

    clear;
    programTitle="${1}";
    programFind="`find ../Development -name ${programTitle}`";
    programPath="${programFind%/*}";
    programName="${programFind##*/}";
    cd "${programPath}/${programName}";
    currentPath="`pwd`";
    echo;
    echo "Program Info";
    echo;
    echo "Program Title = ${programTitle}";
    echo "Program Find  = ${programFind}";
    echo "Program Path  = ${programPath}";
    echo "Program Name  = ${programName}";
    echo "Current Path  = ${currentPath}";
    echo;
    # this is where arduino does all the work
    arduino --board adafruit:avr:feather32u4 --verbose-build --verbose-upload --preserve-temp-files --upload --port /dev/ttyACM0 ${programName}.ino
    programBuildTmpPath="`find /tmp -name ${programTitle}.ino.elf 2>/dev/null | sed 's|^/tmp/||' `" # | sed 's|^/tmp/||'"; #find /tmp \( -not -readable -o -not -executable \) -prune -name 'adruino_build*'
    programBuild="`dirname ${programBuildTmpPath}`";
    programBuildPath="/tmp/${programBuild}";
    programParentPath="`dirname ${currentPath}`";
    programBuildPathNew="${programParentPath}/${programTitle}_Build";
    echo "Program Info";
    echo;
    echo "Program Title = ${programTitle}";
    echo "Program Find  = ${programFind}";
    echo "Program Path  = ${programPath}";
    echo "Program Name  = ${programName}";
    echo "Current Path  = ${currentPath}";
    echo;
    echo "Program Build Info";
    echo;
    echo "Program Build Path Tmp  = ${programBuildPath}";
    

     

     

    In this segment the sudo Sergeant demonstates how you can sidestep the Arduino Development Environment. If you're like Felix and you are familiar with the Arduino IDE, you can press "Ctrl ," to go to the preferences and interface with an external editor. While you'll still need the Arduino Development Environment open in order to compile and upload code, you can choose an environment that is more comfortable for you while you are coding. Felix was looking for more flexibility than that so he went looking for ways to compile to terminal.  He stumbled upon some instructions on how to do this on the Arduino manual page.  He walks you through how to call Arduino directly from terminal. He's already looked up and found the arguments you need to send to it and written a script so it takes the argument, uses that argument to find out where the code is, and takes the .INO file and uses it as the input for the arguments going into the Arduino through terminal. In order to find out all the arguments that would be necessary to send to Arduino from the terminal in the preferences of Arduino you need to click on show verbose output during compilation and upload.

     

    Felix shares his screen to show you what the output looks like when you go to compile. He goes through the output and finds the line that tells him the microcontroller argument that he needs to send to. He also sends along the argument for the .INO file that he wants to compile. Its at this point that he closes out the output screen, as he's got his script right in front of him. The editor of choice for handling his script on Linux is the K Develop IDE. He appreciates its look and feel as well as the fact that he can split his windows into two, giving him a pane on the left and the right. This also allows him to use a dropdown to go to run and configure launches. Felix demonstrates the steps he takes to call the script he wrote, Soroban Programmer. He sends an argument to the script. This is the point where you hit "Shift F9" on your keyboard.  This does the same thing as hitting "Ctrl u" on the Arduino Development Environment.

     

    Do you have a preferred way to code outside the Arduino Development Environment?

     

    Let us know in the comments below!