element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
sudo Sergeant
  • Challenges & Projects
  • element14 presents
  • sudo Sergeant
  • More
  • Cancel
sudo Sergeant
Documents sudo Sergeant 04: Ditch the Arduino IDE for the Linux Terminal
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
sudo Sergeant requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Engagement
Author: tariq.ahmad
Date Created: 12 Sep 2017 6:49 PM
Last Updated: 18 Mar 2018 5:54 PM
Views: 428
Likes: 9
Comments: 7
Related
Recommended

sudo Sergeant 04: Ditch the Arduino IDE for the Linux Terminal

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

 

 

You don't have permission to edit metadata of this video.
Edit media
x
Upload Preview

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!

  • arduino programing
  • sudo sergeant
  • arduino terminal
  • sudo feedback arduino
  • arduino_vcp
  • gnu linux
  • arduino ide
  • arduino_tutorials
  • arduino
  • sudosergeant
  • Share
  • History
  • More
  • Cancel
Anonymous

Top Comments

  • echinos
    echinos over 4 years ago +4

    Registered just to comment on this video.

     

    Awesome work Felix, this is terrific information. Keep it up! I'm enjoying Sudo Sargeant, especially as an avid linux user myself.

    Bravo.

  • DAB
    DAB over 4 years ago +3

    Nice update Felix.

     

    DAB

  • lastmove
    lastmove over 4 years ago

    This is pretty cool

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • idanre1
    idanre1 over 4 years ago

    Hi

    I am using linux in my dayjob so its only trivial wanting the same when at home

    I am using arduino.mk which allows to develop for arduino using the makefile approach.

    https://github.com/sudar/Arduino-Makefile

    Using: apt-get install arduino arduino-mk

    This way you can have any IDE you want :-) 

     

    Sometimes you want to have dual code, e.g. Connect rpi and arduino using i2c and you need to code them both, I have an example makefile in my github

    https://github.com/idanre1/makefiles/blob/master/arduino_plus_db.mk

     

    Each platform has different path for its srs files and you can use make with two target, 1 compile linux code, 2 compile and upload arduino code

     

    Regards

    Idan

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • WarrenW
    WarrenW over 4 years ago

    Waiting for the extra content with baited breath, keep it coming.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • technicus
    technicus over 4 years ago in reply to echinos

    Thanks Brian McGillis!!!

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • technicus
    technicus over 4 years ago

    There is more to come.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    Nice update Felix.

     

    DAB

    • Cancel
    • Up +3 Down
    • Reply
    • More
    • Cancel
  • echinos
    echinos over 4 years ago

    Registered just to comment on this video.

     

    Awesome work Felix, this is terrific information. Keep it up! I'm enjoying Sudo Sargeant, especially as an avid linux user myself.

    Bravo.

    • Cancel
    • Up +4 Down
    • Reply
    • More
    • Cancel
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube