VoidMain.net It's a website!


Arduino IDE – Adding a little Emacs!

I've been using the Arduino IDE for a few weeks now and have to say that I like it's simplicity. However, I typically just use Emacs for text editing and only use Arduino for uploading to the board because I need my Control+ stuff. I'm not looking for everything...just the basics like Control+f for next character and Control+a for beginning of line. After hours of searching the Internet I figured I'd just hack it up a little and do it myself.

It's not pretty but it gets the job done and now I can use the Arduino IDE for editing and uploading!

FYI, I only tested this on my Mac...YMMV.

First, go here --> http://code.google.com/p/arduino/wiki/BuildingArduino. This will walk you through download the source code for the Arduino IDE. I won't hold your hand through that part...just read and follow the instructions.

Next, change directory to /app/src/processing/app/syntax

Then, open PdeTextAreaDefaults.java with your favorite text editor.

Now, look for the portion of the the function named PdeTextAreaDefaults() that looks like this:

inputHandler.addKeyBinding("MS+UP", InputHandler.SELECT_DOC_HOME);
inputHandler.addKeyBinding("CS+UP", InputHandler.SELECT_DOC_HOME);
inputHandler.addKeyBinding("MS+DOWN", InputHandler.SELECT_DOC_END);
inputHandler.addKeyBinding("CS+DOWN", InputHandler.SELECT_DOC_END);
inputHandler.addKeyBinding(mod + "+ENTER", InputHandler.REPEAT);
document = new SyntaxDocument();
editable = true;
electricScroll = 3;
cols = 80;
rows = 15;

This is roughly line #136 (As of Arduino IDE Version 0022)

Now, between these two lines:

inputHandler.addKeyBinding(mod + "+ENTER", InputHandler.REPEAT);
======RIGHT HERE======
document = new SyntaxDocument()

You will paste this code:

// Custom - A little bit of Emacs
inputHandler.addKeyBinding("C+f", InputHandler.NEXT_CHAR);
inputHandler.addKeyBinding("C+b", InputHandler.PREV_CHAR);
inputHandler.addKeyBinding("C+p", InputHandler.PREV_LINE);
inputHandler.addKeyBinding("C+n", InputHandler.NEXT_LINE);
inputHandler.addKeyBinding("C+a", InputHandler.HOME);
inputHandler.addKeyBinding("C+e", InputHandler.END);
inputHandler.addKeyBinding("C+k", InputHandler.SELECT_END);

Go back to this page --> http://code.google.com/p/arduino/wiki/BuildingArduino, build and run your fancy new Arduino IDE. If you are familiar with Emacs you should be able to figure most of the KeyBindings out. However, there is one caveat. I couldn't figure out how to cut text from the cursor to the end of the line (sometimes called a "yank"). So, as a workaround I just have Control+k selecting the text from the cursor to the end of the line. Then one could use copy or cut shortcuts from there.

I hope this helps someone else because I know it has helped me a ton. Thanks for reading.


Arduino, Arduino, where art thou?

After a few days of contemplation I have decided to dive into the world of Arduinos. Initially, I was introduced to the world of microcontrollers by my boss. He is a hardcore PIC guy and has been developing on those for many years. However, I am not nearly the electronics guru that he is.

After a few small projects I did get the hang of working with a PIC and developing a PCB. I created a cool little board that takes serial in and puts it back on the line as an echo and also puts it out on a little 16x2 LCD. I built in a few commands to tell the board what to put on the LCD on startup. It was a great exercise in electronics and microcontroller development. It culminated with me sending my designs for PCB printing. They turned out great and I soldered on all of the parts (plus a few jumper wires, oops) and was quite proud.

So, now that I felt a little more comfortable I wanted to see what else was out there. I'm starting to venture into the FPGA world a bit but that is for another project at work. I wanted something that I could do, in my spare time, to build upon what i learned in my PIC projects. In stepped Arduino.

I've been hearing the buzz about these little guys for quite a while. Now it was time to find out more information about what they could do. Today, I sit waiting for my order to arrive from SparkFun. I got the inventors kit that includes an Arduino UNo and enough parts and pieces to create 14 unique circuits. Servos, diodes, pots, and a ton of other geeky stuff. I'm pretty excited.

Over at the Arduino website you can download the open-source compiler and uploader software. You can learn a ton about the boards from their fantastic documentation. You can contribute on the wiki and forums. It's a really great community. The language they use is C/C++ based and they have great libraries. I'm very excited about this venture and can't wait to post a few Arduino projects!

Arduino UNo

SparkFun Inventors Kit


Hello World!

WordPress is setup and ready to go. Let's see if I can actually post stuff on a regular basis now.

Filed under: Stuff No Comments