For some reason I’m really really amused by this comic about packages. I think it might be because I’m waiting for the USPS to release one of mine from “missent” limbo, which I believe is actually more like “misdelivered”, return to sender, so he can re-ship to me).
I didn’t have anything to do at the paper last night so I played
with connecting some parts together to make the Arduino microcontroller
board connect to a parallel LCD I had lying around to display
accelerometer data from a Wii nunchuck (something I had read is possible,
but hadn’t tried out yet)…
It turns out it’s pretty easy, but I didn’t have any female connectors
for the pin-headers so the analog pins are jury-rigged right now. The
code, which is not terribly optimized, spends most of its time in the
decimal conversion since (I’m guessing) there is no hardware for division.
If that is removed, and it transmits the raw data (say in hex) it becomes
very fast. I get about 2-3 displays per second with the code as-is.
So in the end, it’s a nifty project that’s able to read a 3-axis
accelerometer up to about 2.5 g’s, along with some other stuff I’m not using.
In the process I also noticed that the Mac puts out enough power over the
USB port, even in standby mode, to power the whole setup with the backlight
on.
Common errors that I encountered were that the board needs a reset if the
TWI comed unplugged and that if the display is totally blank the contrast
pot probably fell off. If the display shows junk after a while, it’s
probably not enough delay in LCD4Wire.cpp for your version. I did tweak
them a bit.
The unoptimized code, which includes string.h for no good
reason, is a little over 5.5 KiB compiled.
References
My code for download, nunchucklcd.tgz