Tuesday, June 16, 2009

LCD difficulties

After putting together a schematic in EAGLE for the shower control circuit, I tinkered a bit trying to get a scrounged Powertip PC1602-G character LCD working. Serial LCDs from SparkFun are easy to use but expensive, in addition to hogging the serial port and being available only in 16x2 and 20x4; I'd like to be able to use cheapo 8x2 or other displays.

I soldered on a pin header and got to breadboarding it with an iDuino, but quickly discovered that the tutorials are pretty haphazard, and I wasn't able to get any output using the LiquidCrystal library in spite of quadruple-checking my schematic and breadboard connections.

I tried Limor's tutorial but got no result, and I think editing the library to set the pins is an odd (wrong?) way for a library to work. I even used the exact same pins-- no dice. I wonder if the scrounged LCDs I'm using have custom commands that makes them incompatible with the library-- I need to try a different LCD, and maybe use Massimo's raw example.

Update: In a comment, Al asked if the LCDs I was trying weren't HD44780-compatible at all and... oops, thats the problem! I got it working fine with an LCD scrounged from an old Brady Labelmaker, which contains an actual Toshiba HD44780.

Saturday, June 6, 2009

Xcode > Arduino?

After bookmarking melka's Xcode Arduino template the other night, it was funny to see it posted the next morning on the Make: blog-- all signs point to Xcode, so here I go. Not having experience with a full-featured IDE or "real" C++ development, it should be an interesting learning experience.

The first thing I had to do was get the latest Xcode, 3.1.2, a 995.9MB download-- I installed 3.0 a while ago, but it complained when I tried to open melka's template. Got it installed, then went through melka's README and... everything worked!

I screwed up the first run through by renaming and moving the project. On the second try, I copied the unzipped "Arduino Base Template" to my desktop as "ArduinoBaseTemplate" and everything worked with the new template in Library/.../Project Templates/Arduino.

All is not wine and roses, though-- a test sketch that worked fine in the Arduino IDE gives me a lot of errors in Xcode, all related to the order I'm declaring things-- I generally define functions after my setup() and loop() calls, but Xcode gives me "was not declared in this scope" errors for all of them. It seems I do need to learn the basics of C++ to get this working. How to get a crash course in this stuff? Google came up with "C++ Language Tutorial" so, more to read...