How will you be developing code for the Edison? Here are a few methods we're exploring!
You might have noticed we've been going crazy over the Edison lately. We can't help it. We're pretty enamored with the power this tiny, modular computer holds.
While I was at IDF a few weeks ago, showing off our Blocks, the most common question I got was: "OK, I understand this thing is awesome...how do I do anything with it?" It's a fair question. The Edison is unlike any microcontroller development platform we're used to -- there's no USB connector, pin break outs, or really any interface we're used to. And it's nothing like a Raspberry Pi, BeagleBone, or pcDuino -- there's no keyboard/mouse/monitor trio for developing on it as if it were a computer terminal.
The Edison is something wholly new to our little maker universe, but it turns out the development options aren't all that dissimilar from what we're used to. In this blog post, I want to highlight some of the routes you can take when you're developing on the Edison -- everything from remaining in the cozy confines of Arduino to cross compiling C/C++ to quick Python or node.js scripts.
The Edison comes with nearly full Arduino support, as everything seems to require it these days. You'll have to download the Edison version of Arduino, but, beyond that, things should begin to look familiar.
All of the function calls, and the rest of the API is just like what you're used to with standard Arduinos. Plus, if you use an Arduino Breakout Board, the pin-out is even shield-compatible. I see that familiarity coming in handy for two main markets: educators and rapid prototypers. Educators have the field-proven simplicity of the Arduino interface. Seasoned tinkerers, many of whom just need to get something working as a proof of concept, have a wealth of example sketches and libraries to depend on. Regardless of how ugly it may be under the hood, Arduino can get stuff done quickly. Speaking from experience, I used Edison's Arduino interface -- with a few modifications to the core code's pin multiplexing -- to prove out the OLED Block, so we can quickly move it along to production.
Of course, what's going on behind the single-window IDE is wholly different from the Arduino we're used to. The libraries -- everything from digitalWrite
to WiFi -- have all been re-written to work within the Edison's Linux kernel. To load code onto your Edison, the Arduino IDE compiles it locally, then uses lsz to transfer the executable over to the Edison. The "Arduino sketch" is actually just one of many processes being managed by the operating system.
The familiarity you might have with Arduino makes it great, but as a development environment -- especially on the Edison -- it can become very limiting, very quickly. Still, if you're just getting into Edison development, I'd recommend giving the Arduino interface a quick try. What I've really benefited from is digging through the libraries and core code, seeing how the file system is manipulated to manage everything from pin-toggling to UART-printing. Investigating that source code can be especially helpful as you transition to the next step...
If you know your way around gcc, g++, linkers, makefiles, and the like, you may want to jump off the Arduino boat and dive into a more general C/C++ development environment. The Edison's default Yocto Linux install includes both gcc and g++ for all of your compiling needs.
The hard part with this approach is getting your files onto the Edison in the first place. It does come with vi, so if you're some kind of masochist you can write and re-write everything directly on the Edison through a console. There are better options, though.
Since the Edison has built-in WiFi, you can connect it to the same network as your development box, then use SSH to upload new files to it. With programs like WinSCP (Windows) or Cyberduck (Mac), you can even use a file browser to manage the files.
An even better approach, which I think we'll see become the most popular one, is using a personal computer to cross-compile all of the Edison's code. Then, after your computer quickly compiles, just transfer the executable over to the Edison (via SSH or USB) and execute. Intel offers an SDK on their downloads page, which has just about everything you'll need to cross-compile. You can set up an environment in Eclipse, or just use a little makefile-fu to call the cross-compiler (MinGW on Windows) to build your program. Hopefully there'll be more documentation on this approach as the community grows around it (whoops...sounds like volunteer talk).
If interpreted languages are more your thing, the Edison includes support for both Python and node.js. These tools are great because they already have tons of support and examples behind them -- and in a lot of cases they're platform agnostic. Want to post to Twitter? There's undoubtedly a Python script for that. Need to check the score of the baseball game? There's a node.js package for that. One of the Edison's main targets is IoT applications, and Python/node.js have become very popular in that realm.
Building on that, if you're really interested in IoT and node, check out the Intel XDK IoT Edition. A lot of the XDK seems like it's centered around smartphone app development, but there is a section geared around "Internet of Things with Node.js Projects."
I know next to nothing about node.js, but the simplicity of this environment really has me itching to learn more. Following along with their examples, I was able to remotely upload a node application to blink LEDs. This has a lot of potential to be the "Arduino" of node.js on the Edison.
As the Edison's a brand new platform, most of the development schemes are just taking their baby steps. It'll be fun to see how the community grows around Edison development. Have you had a chance to develop on the Edison yet? What works best for you? What kind of example code would you like to see when we release the Blocks?