What would be a good programming language (or a set of libraries for C++) to interface with electronic components (stepper motors etc.)?

StackOverflow https://stackoverflow.com/questions/700025

Question

I'm not an electronics guy, so I might not be able to explain precisely what I need. This is a question a friend keeps asking me.

What my friend is looking for is a programming language that would allow him to:

  1. Interface with hardware (via serial and USB ports).
  2. Write multithreaded code.
  3. Throw together UIs very quickly.
  4. Port his code to Linux and OS X as easily as possible (okay, this is what I want).

He is building a tool for a local group that teaches very basic robotics to college students. Right now he's using C++, but writing the UI code in C++ is not exactly a fun task. He is also using some Windows-specific libraries for (1), which means I can neither try out his code nor help him with fixing bugs (I use a Mac).

EDIT: Libraries for Python/Ruby are welcome.

Was it helpful?

Solution

You may want to have a look at the rather complementary Processing and Wiring tools. Processing is an environment for building user interfaces, and Wiring is an environment for programming I/O boards such as the eponymous Wiring board, its simpler cousin Arduino, and related devices. The Wiring boards typically communicate with a desktop computer over a serial link, or USB with serial emulation.

OTHER TIPS

Java might be a good option here. It has libraries available for the low-level threading and communication APIs, and it should perform well enough for a control loop. I know it has a serial port communcations library, and I believe there are some open-source USB libraries. For the UI, you could use the Java 2D Graphics API, or for a more advanced UI you could try the slightly neglected Java3D or newer JOGL libraries. Swing has its faults, but it's actually pretty easy to use for making basic forms UIs.

If you want easy and lots of supported hardware I think your best bet is Labview. It's all graphical programming (drag blocks, make connections) and many USB devices (DIO for instance) have Labview support. Serial support is built-in. It can make UIs rather easily (it's primarily intended for GUI control).

Ruby and Shoes (GUI) would work nicely, especially well suited to a learning environment / multiplatform

Edit - Found it (its a bit hard to find):

http://shoooes.net/

ACE (http://www.cs.wustl.edu/~schmidt/ACE.html) is a platform independent C++ library (no UI), QT (http://www.qtsoftware.com/products/) is a cross platform UI library for C++. Accessing hardware is unfortunately something that is still platform dependent)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top