<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Arduino on Grant Lucas</title>
    <link>https://grantlucas.com/tags/arduino/</link>
    <description>Recent content in Arduino on Grant Lucas</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 26 Mar 2014 11:26:41 -0400</lastBuildDate>
    <atom:link href="https://grantlucas.com/tags/arduino/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Using Vim for Arduino development</title>
      <link>https://grantlucas.com/posts/2012/09/using-vim-for-arduino-development/</link>
      <pubDate>Wed, 19 Sep 2012 11:26:41 -0400</pubDate>
      <guid>https://grantlucas.com/posts/2012/09/using-vim-for-arduino-development/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s a quick post on setting up Vim for Arduino development instead of using&#xA;the Arduino IDE. If you&amp;rsquo;re a heavy Vim user, it can be a bit of a shock to go&#xA;into a different editor. Thankfully the setup is pretty easy to get this all&#xA;working with Vim. This post is assuming you are comfortable with how Vim is&#xA;setup and ideally already have an environment that works for you.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;update-march-26-2014&#34;&gt;Update March 26, 2014&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#update-march-26-2014&#34; title=&#34;Click to copy link&#34;&gt;&lt;i class=&#34;fas fa-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://github.com/tclem/vim-arduino&#34;&gt;Arduino Vim plugin&lt;/a&gt; originally&#xA;referenced in this post seems to have been abandoned by the project creator.&#xA;The README has been updated pointing to a &lt;a href=&#34;https://github.com/jplaut/vim-arduino-ino&#34;&gt;newer Vim Arduino&#xA;plugin&lt;/a&gt; using&#xA;&lt;a href=&#34;http://inotool.org/&#34;&gt;Ino&lt;/a&gt;, command line toolkit for working with Arduino&#xA;hardware. I haven&amp;rsquo;t had a chance to test this new solution out fully, but it&#xA;looks promising. If you have any issue with my guide below using the old&#xA;plugin, tryout the new plugin and Ino and let me know how it goes!&lt;/p&gt;&#xA;&lt;p&gt;Once I have a chance to fully test and understand the new build method, I&amp;rsquo;ll&#xA;update this post with the new information. On first look, it looks like a&#xA;project folder structure is imposed by Ino, &lt;code&gt;lib&lt;/code&gt; and &lt;code&gt;src&lt;/code&gt; folders, but I&#xA;don&amp;rsquo;t think that&amp;rsquo;s too much of an issue in the long run. Overall, I think&#xA;relying on a command line build process will probably be more stable than&#xA;trying to tie into the Arduino IDE like before.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;install-the-arduino-ide&#34;&gt;Install the Arduino IDE&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#install-the-arduino-ide&#34; title=&#34;Click to copy link&#34;&gt;&lt;i class=&#34;fas fa-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;&lt;em&gt;Wait. What?!?&lt;/em&gt; I hear you say. I know, I know. We&amp;rsquo;re not actually using the&#xA;Arduino IDE but we need it for some configuration and the files it installs.&#xA;The Vim plugin we&amp;rsquo;ll be using ties into what the IDE installs and configures so&#xA;it&amp;rsquo;s needed. You can download the IDE from the &lt;a href=&#34;http://arduino.cc/en/Main/Software&#34;&gt;Arduino&#xA;site&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;install-vim-arduino-plugin&#34;&gt;Install vim-arduino plugin&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#install-vim-arduino-plugin&#34; title=&#34;Click to copy link&#34;&gt;&lt;i class=&#34;fas fa-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;To get the main goodness of compiling, monitoring and deploying to an Arduino,&#xA;grab the latest version of &lt;a href=&#34;https://github.com/tclem/vim-arduino&#34;&gt;vim-arduino&lt;/a&gt;.&#xA;Install it in your .vim folder using what ever method you use to manage your&#xA;Vim plugins. &lt;strong&gt;Hint:&lt;/strong&gt; I&amp;rsquo;d recommend&#xA;&lt;a href=&#34;https://github.com/tpope/vim-pathogen&#34;&gt;Pathogen&lt;/a&gt; as it makes installing as&#xA;simple as dropping the plugin folder into a bundle folder.&lt;/p&gt;&#xA;&lt;h2 id=&#34;vim-syntax-file&#34;&gt;Vim syntax file&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#vim-syntax-file&#34; title=&#34;Click to copy link&#34;&gt;&lt;i class=&#34;fas fa-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Next up is to get the syntax file so we can have nice colour coding for &lt;em&gt;.pde&lt;/em&gt;&#xA;and &lt;em&gt;.ino&lt;/em&gt; files. Download the latest&#xA;&lt;a href=&#34;http://www.vim.org/scripts/script.php?script_id=2654&#34;&gt;arduino.vim&lt;/a&gt; and install&#xA;it in your Vim syntax folder. To get the syntax to apply to the correct file&#xA;types add the following to your vimrc file&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&#xA;&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;&#xA;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-1&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-1&#34;&gt;1&lt;/a&gt;&#xA;&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34; id=&#34;hl-0-2&#34;&gt;&lt;a style=&#34;outline:none;text-decoration:none;color:inherit&#34; href=&#34;#hl-0-2&#34;&gt;2&lt;/a&gt;&#xA;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#xA;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;&#xA;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;au BufRead,BufNewFile *.pde &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;set&lt;/span&gt; &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;filetype&lt;/span&gt;&lt;span style=&#34;color:#ff79c6&#34;&gt;=&lt;/span&gt;arduino&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;au BufRead,BufNewFile *.ino &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;set&lt;/span&gt; &lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;filetype&lt;/span&gt;&lt;span style=&#34;color:#ff79c6&#34;&gt;=&lt;/span&gt;arduino&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&lt;h2 id=&#34;configuring-the-arduino-ide&#34;&gt;Configuring the Arduino IDE&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#configuring-the-arduino-ide&#34; title=&#34;Click to copy link&#34;&gt;&lt;i class=&#34;fas fa-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Before trying to compile and deploy with Vim, get it all working with the&#xA;Arduino IDE first as the Vim plugin just calls from the settings saved by the&#xA;IDE. If it&amp;rsquo;s working in the IDE, it should work in Vim. Make sure you select&#xA;the right tty.usbmodem* serial port from Tools &amp;gt; Serial Port in the IDE.&#xA;&lt;strong&gt;Note:&lt;/strong&gt; This will only show when the Arduino is plugged in.&lt;/p&gt;&#xA;&lt;h2 id=&#34;working-from-vim&#34;&gt;Working from Vim&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#working-from-vim&#34; title=&#34;Click to copy link&#34;&gt;&lt;i class=&#34;fas fa-link&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Once you can communicate with your Arduino from the IDE you should be fully&#xA;good to go with Vim. You shouldn&amp;rsquo;t have to open the IDE unless you want some&#xA;example code. Open up your sketch file in Vim and use &lt;code&gt;&amp;lt;Leader&amp;gt;ac&lt;/code&gt; to compile a&#xA;sketch, &lt;code&gt;&amp;lt;Leader&amp;gt;ad&lt;/code&gt; to compile and then deploy to the connected Arduino and&#xA;&lt;code&gt;&amp;lt;Leader&amp;gt;as&lt;/code&gt; to open a new window with &lt;code&gt;screen&lt;/code&gt; to monitor the serial output&#xA;from the Arduino.&lt;/p&gt;&#xA;&lt;p&gt;And that&amp;rsquo;s it! Overall I&amp;rsquo;m really happy with the setup so far. Let me know if&#xA;it works for you or if there are any issues.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
