Archive for December, 2013
So I was reading this post the other day when I was trying to determine why one of my Arduino sketches was puking out garbage on the serial port. It was a good read, and I definitely recommend you go read it too (particularly if you are an advanced Arduino programmer). I had no idea how flawed the Arduino core libraries were. So I went digging through the source code (why the hell hadn’t I done this yet?). Sure enough…. yeah…. needs work. Things have indeed improved since Alan’s post was originally written. But, as he pointed out, the hardware serial library still needs fixing (among other things). Nonetheless, it got me thinking…. maybe I need to “graduate” bit in Arduino-land. So while I was googling around and reading all kinds of forum posts and talking to people on IRC, etc, one of the common things people kept talking about is just using ATmel Studio and doing direct pin access.
I had stayed away from Atmel Studio because event though it is designed to program Atmel AVR chips (which is what the Arduino platform is built on), it is not specifically geared toward the Arduino platform, and more importantly, it is essentially customized version of Microsoft Visual Studio…. thus, it is not cross-platform compatible. In my previous post, I discussed my preferences when it comes to Arduino IDEs and the importance I place on cross-platform IDEs. While looking into the Atmel Studio 6.1, I was reading up on the Atmel Gallery and decided to go check it out and see what kind of add-ons were in there. Wouldn’t you know…. right on the front page was the Arudino IDE for Atmel Studio. You know what? This thing is BAD ASS.
I know, I know, I know…. “But it only works on Windows!”. Yes… unfortunately, this is still true. But I gotta tell ya… I think I like it better than Visual Micro. If you’re a Windows user, or at least aren’t as anal about platform compatibility as I am, then you’re gonna love it. I’ve only gotten to use to write one sketch (a BIG one) and edit a couple others, but so far…. it’s fairly superior to almost everything else I’ve used (so far).
Been a long time. My professional duties and chaotic life have precluded me from things like blogging for a while now. But since I’m on vacation, time to catch up!
So I’ve been questing for a better Arduino IDE. I really enjoy the Arduino in its various forms, but I find the IDE rather lacking….. and I’m not the only one. It seems to be a rather popular search. Everyone is looking for something better. I’ve seen some different forks of the standard Arduino IDE, but they all just seem to add additional hardware support or a couple small features. None of them make the IDE (specifically the editor) any *better*. Being a guy who spends much of his time in either Microsoft Visual Studio or Eclipse, using the standard Arduino IDE leaves me wanting more. Sure, it is perfectly fine for beginners, but for professionals or more advanced users, it seems lackluster.
So I began my quest. The first thing I ran across was MariaMole. It is a much better IDE, but as of this writing, it only runs on Windows (Linux and MacOS support planned). Also, I don’t care of the default color scheme (although still better than Arduino IDE) and I could not find an easy way to change it. But the killer is not being (currently) cross-platform. I develop on Windows, Linux (Mint) and MacOS X. So I need, if possible, an IDE that can run on all 3.
Then I came across Visual Micro. Let me get this out of the way: I LOVE Visual Micro. It is hands-down the best IDE I’ve used for Arduino development so far. Except for one problem: It only works on Windows. This is because it is a Visual Studio add-on. That in and of itself isn’t bad (because I love Visual Studio), but not being cross-platform is. For a while, I was doing all my ‘serious’ Arduino development in Windows using Visual Micro, then just using the standard Arduino IDE on Linux and MacOS X.
Then I thought, “Hey… I bet there’s an Eclipse plugin out there for this”. Sure enough, there is. At first, I read these instructions and thought, “This seems like a lot of work”. Then I saw the link for the actual plugin. I ignored the fact that the documentation kept referencing old versions of Eclipse (as of this writing I’m using ‘Keppler’ everywhere) and proceeded to install and configure the plugin. Still not terribly simple, but I get to use a cross-platform IDE of choice. Also, it does not support *.ino files. Instead, it produces ‘main.h’ and ‘main.cpp’ files. This sucks if you need to be backward compatible with the Arduino IDE. Also, it was fairly buggy and more often than not, I either could not get my source to build or could not get it to upload. I read tons of stuff in forums, etc and plenty of people suggested various fixes to my various problems, but ultimately I gave up. If I have to invest that much effort into my tools (especially on 3 platforms), then I just go find a better tool.
So I kept searching. I eventually came across this article describing using QtCreator for Arduino development. Fireworks went off in my head. “OF COURSE!!”, I thought. QtCreator is *built* for C/C++ dev and supports templates, etc. And it’s cross-platform! I love QtCreator as an IDE in general, so I got really excited. I went off and downloaded the latest build of QtCreator and Qt5. I also found a QtCreator project template for Arduino here. Even though, the documentation seems a little dated, it worked just fine. There are some caveats: First, like the Eclipse plugin, the project template creates *.h and *.cpp files instead of a *.ino. I chose to rename the *.cpp file to *.ino, which QtCreator is still happy to open, and then I just include it in the *.h file. This method is also supported by the Arduino IDE, because if it finds a *.h file with the same name as your *.ino file, it opens them both in separate tabs in the editor. I then adjust my paths depending on what platform I’m compiling on using #defines (see an example on my github page here). I also had to create separate *.includes files for each platform. But hey, minor tweaks to get to use a beautiful IDE. One problem, compile/upload functionality is a bit sketchy. Most of the time, I can get it to compile, but I usually can’t get it to upload. So I started using QtCreator to do all the work, and then just used the Arduino IDE to compile and upload, and also for the serial monitor. Still not quite an ideal solution.
A co-worker asked me what IDE I used for Arduino development and I pretty much gave him all the options I just laid out for you. He decided to go the QtCreator route also. But his inquiry renewed my quest. So I went looking again. That night, I stumbled across a single mention of something called ‘Stino’ in a forum post. I decided to go look.
It was wonderful.
As it turns out, Stino is a plugin for Sublime Text. I had never heard of either. This was a new experience, and I was not disappointed. I followed the instructions and went and downloaded Sublime Text 3. Next, I enabled package control. Then, using the package manager, I downloaded and installed ‘Stino‘. And guess what? Its cross-platform!! I opened existing projects on all 3 platforms and was able to compile and upload without any alterations. In fact, the Stino plugin basically provides all the existing functionality of the Arduino IDE (including serial monitor) and is every bit as simple to use, but with a MUCH better code editor. It supports color themes, syntax completion, etc. It even has console output for the compile/upload process just like the Arduino IDE. And…. it natively supports the *.ino format and uses that by default when creating projects.
I’m a fan-boy, to say the least. Not gonna lie. As much as I love QtCreator, I find Stino + Sublime Text 3 to be the best (cross-platform) IDE so far and I now do ALL my Arduino development using it. Plus, since the projects it creates are basically regular Arduino projects, they are directly compatible in both IDEs.
For the life of me, I can’t figure out how there hasn’t been more buzz about this. So…. I recommend you at least give it a try.
That being said, I’m going to get back to slinging code myself. I’m currently working on a Christmas light controller using an Arduino Uno R3. More on that soon!