kinda OT: latest fun with Arduino, UI with a single knob/button and screen.

Levi Pearson levipearson at gmail.com
Sun Feb 3 13:51:46 MST 2013


On Feb 3, 2013 12:31 AM, "Michael Torrie" <torriem at gmail.com> wrote:
>
> Just wanted to show off some Arduino stuff.  Not that I need the
> validation; I just think it's really fun and cool.  As fun as Linux!
> Most of my coding on this latest project has gone into making a sort of
> event-driven UI system for the Arduino that uses only a rotary encoder
> dial/pushbutton combo for user input, and a 2-line LCD display.  I'm
> well on my way to being the next Steve Jobs with minimal, yet intuitive
> input methods (or not).
>
> I'm please how it worked out.  It's all written with some simple C++
> classes and a bunch little tiny state machines that process the events
> from the main loop.  The end result is a UI that kind of behaves
> linearly while preserving the ability to still do things like
> calculations, read signals, etc.  My flow meter is read with an
> interrupt but the encoder and button are polled.  Eventually I'll have a
> unified interrupt routine to read interrupts from the encoder, the flow
> meter, and the softwareserial connection (for communicating with another
> arduino).  I pretty much implemented everything myself (partly for the
> experience, partly because I didn't like the existing code people have
> written), so it's not quite yet super optimized, but it all works, and
> the logic to read the encoder (a gray code decoder routine) deals nicely
> with bounces and stays pretty darn accurate, indent to indent as you
> turn it.

Embedded programming is way fun. As someone who knows their way around a C
compiler, you might consider an ARM M-profile microcontroller like a TI
Stellaris part. I believe they've got a cheap Launchpad eval board that
would be a cheap way to get started. Qemu also emulates a Stellaris board.

Unlike many microcontrollers, the M-profile chips can be programmed
entirely in C, even the initial boot code and ISRs. No asm stubs required!
They also have low-latency interrupt handling and a priority scheme that
allows you to protect critical regions without entirely disabling
interrupts.

Arduino is awesome to introduce people to embedded programming, but
experienced programmers ought to branch out and see what else is available.

I also recommend James Grenning's excellent book on using Test-Driven
Development for Embedded Systems Programming. (Author's name should be
correct, but I probably mangled the title). It's a great tool for embedded
development, because it's Way easier to debug on your build machine than on
your dev board!


More information about the PLUG mailing list