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...

4 comments:

  1. Nice to know that it worked on at least someone else's computer ^^

    ReplyDelete
  2. melka's link looks broken, can you upload the xcode template again? :)

    ReplyDelete
  3. Obviously you know this by now, but Xcode processes lines from top to bottom. So for some function/statement to be "seen" it has to appear above where it's later referenced. Hope this helps someone else.

    ReplyDelete
  4. I've developed an Xcode 4.3 template for Arduino and chipKIT boards.

    Code is here https://github.com/rei-vilo/embedXcode
    And explanations are there http://bit.ly/xy0UQU

    Enjoy and participate!

    ReplyDelete