How You Tell the Machinery What To Do

While I dearly love it when I am able to get my machines to do what I want by writing my own software, the only reason I learned to program is because I had to. When I first started getting into this stuff, there was nothing out there that I could buy which would enable me to cheaply connect a motor to my PC. I started with BASIC, since it sounded easy and came bundled with DOS. Since then, I still use BASIC in my educational work, but have "had to" learn C (because it was way faster than BASIC back then), LISP (because you can make AutoCAD do really cool things with it), LOGO (because the Museum uses MicroWorlds to teach kids), Python (so I can use Blender to make toolpaths), and Javascript. The point is NOT that you have to learn a bunch of languages, but you do have to learn one reasonably well. Once you understand key programming skills (like loops, and if-then stuff), you can readily pick up a new language when it becomes necessary. The commands and syntax vary, but the logic that holds it all together is the same.

I still like BASIC for its simplicity. I still turn to C when I'm doing "serious" work. But it really doesn't matter; choose your language based on what you think will be the best fit for you. Maybe that means it's cheap or free. Maybe you know someone who's an expert and can help you during the painful early phase. Maybe the awesome robot arm that you just got at the scrap yard has a controller that needs a FORTRAN program to run it...

Fortunately, with the wealth of information, tutorials, and software libraries available on the net, learning a language has only gotten easier. There are many sites that can explain more about programming than I can, but I offer a few tips for the beginner:

  • Every programming language has its strengths and weaknesses. Just pick one.
  • Learn by trying to get something simple to work (like flashing an LED). You will learn far more by trying a real experiment, as opposed to just doing book-based exercises.
  • Don't reinvent the wheel. For most tasks, someone has already done the work for you, so try to find a preexisting solution and use it. For example, virtually every language already has a library you can download/install to send bytes out the parallel port.
  • Choose ease over speed. Most likely, your computer is far faster than you need, so it's okay to be inefficient. Programming languages like Python and BASIC, while slower than C or Java can be easier to write or debug (though C and Java are still good choices).