Arduino on Xcode Project — Official Thread

Thank you for your response, I tried re-indexing the way it was mentioned in 4.6 even ater that they don't show any color or auto-complete. pinMode or OUTPUT or Serial.print() doesn't show any sigh of auto completion. :frowning:

in the 2nd post the example what you mentioned is the part of standard C++ code sense, isn't it.
like

int functionName(int an_example,int b_example){
return a_example+b_example;

}

void main(){
int a=10;
int b=20;
cout<<functionName(a,b);
}

in the above mentioned example we are declaring a function functionName and calling it again in the main function. so it works fine since it is standard C++ implementation. But when I try to write:

pinMode(pinNum,HIGH);
Serial.begin(960);
analogWrite(13,HIGH);

they don't show colors and I dont even get code completion suggestions. But they should be actually like this:

pinMode(pinNum,HIGH);
Serial.begin(960);
analogWrite(13,HIGH);

aren't they? Since they are declared in Arduino.h

what i mean is the functions declared in Arduino.h are not being recognised by Xcode while i'm editing in the .ino file. It might have something to do with the Xcode version. I'm using Xcode 4.6.2. Is there anything I'm missing maybe :~

Try commenting the whole Core library for code-sense section except #include "Arduino.h".

// Core library for code-sense
//#if defined(WIRING) // Wiring specific
//#include "Wiring.h"
//#elif defined(MAPLE_IDE) // Maple specific
//#include "WProgram.h"   
//#elif defined(MPIDE) // chipKIT specific
//#include "WProgram.h"
//#elif defined(DIGISPARK) // Digispark specific
#include "Arduino.h"
//#elif defined(ENERGIA) // LaunchPad, FraunchPad and StellarPad specific
//#include "Energia.h"
//#elif defined(CORE_TEENSY) // Teensy specific
//#include "WProgram.h"
//#elif defined(ARDUINO) && (ARDUINO >= 100) // Arduino 1.0 and 1.5 specific
//#include "Arduino.h"
//#elif defined(ARDUINO) && (ARDUINO < 100) // Arduino 23 specific
//#include "WProgram.h"
//#else // error
//#error Platform not defined
//#endif

Thanks a lot.

After commenting out the whole section except #include "Arduino.h" as you mentioned it solved my problem. everything is perfect now. The code sense has started working.

Keep up the good work. :slight_smile: :slight_smile: :slight_smile:

You're welcome!

I'm glad it works now. It seems Xcode goes lost with many files to sort.

I have almost the same problem as Zulkarnine, and the previous solutions didn't work for me =S

The difference is that i have color and auto-complete code with:
pinMode(myLED, OUTPUT);
but i don't have with this:
Serial.begin(960);

=S anyway, Is there any theme to get the color equal to the arduino ide?

zulkarnine:
in the above mentioned example we are declaring a function functionName and calling it again in the main function. so it works fine since it is standard C++ implementation. But when I try to write:

pinMode(pinNum,HIGH);
Serial.begin(960);
analogWrite(13,HIGH);

they don't show colors and I dont even get code completion suggestions. But they should be actually like this:

pinMode(pinNum,HIGH);
Serial.begin(960);
analogWrite(13,HIGH);

aren't they? Since they are declared in Arduino.h

what i mean is the functions declared in Arduino.h are not being recognised by Xcode while i'm editing in the .ino file. It might have something to do with the Xcode version. I'm using Xcode 4.6.2. Is there anything I'm missing maybe :~

DarkFlagster:
I have almost the same problem as Zulkarnine, and the previous solutions didn't work for me =S

The difference is that i have color and auto-complete code with:
pinMode(myLED, OUTPUT);
but i don't have with this:
Serial.begin(960);

As I wrote before,

Code-sense, auto-completion and arguments list are displayed usually without problem in my laptop.

Now, it isn't a 100% hit because code-sense implementation changes with every Xcode release and as Apple is more than secretive about the customisation of Xcode.

Xcode code-sense doesn't seem to be powerful enough to manage virtual functions within classes. Serial.print() is a virtual function.

DarkFlagster:
=S anyway, Is there any theme to get the color equal to the arduino ide?

Sorry, but I can't provide support for Xcode. Please refer to Xcode documentation for interface customisation.

I strongly recommend you to refer to the book Xcode 4 Unleashed by Fritz F. Anderson I purchased thanks to contributions.

Good luck!

Please find a new release of embedXcode:

embedXcode • May 04, 2013 release 48 • Compilation of main.cpp for embedxcode only
embedXcode • May 10, 2013 release 49 • Improved code-sense for core libraries

main.cpp has a conditional statement for compilation based on EMBEDXCODE.

The name of the IDE is included in the pre-processing variable use for code-sense.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :slight_smile:

Hi, I'm trying to get the project configuration working but I have an error on line 16 of easyTransfer.cpp:

_serial->print(0x06, BYTE);

It says: "BYTE was not declared in this scope"
What do you think it could be?

Tx
Gabriele

I don't know. I guess BYTE isn't declared. Try using the Arduino IDE.

Please find a new release of embedXcode

embedXcode • May 21, 2013 release 50 • Arduino and Digispark 1.0.4 compatibility

For the Teensy boards, embedXcode takes into account the Teensyduino installed either as a plug-in for Arduino 1.0.3, or as a stand-alone application /Applications/Teensyduino.app.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :slight_smile:

Please find a new release of embedXcode.

embedXcode • May 23, 2013 release 51 • Project configuration with user’s libraries

The automatic preparation procedure now includes the user's libraries for code-sense.

For example, if you select Arduino Uno as board when you create a new project, all the libraries under the sketchbook/libraries folder define in the Arduino preferences are going to be included to the project.

When I started the embedXcode project back in January 2012, I didn't expect to reach the 51st release!

Thank you for your support, feed-back and help you've provided me during all the development!

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :slight_smile:

Thanks for all your hard work. Does release 51 mean we don't need to do step 3.2.1 (add user's libraries) in the manual

ScottG:
Thanks for all your hard work.

You're welcome! Now the next big challenge is to update my old Mac :~. Xcode is too demanding :(.

ScottG:
Does release 51 mean we don't need to do step 3.2.1 (add user's libraries) in the manual

That's correct. No more manual procedure is required.

However, I keep providing the manual procedures on the User Manual as they might be useful if you make important changes to a project, for example changing the platform.

Got this thing working. Great work!
My only problem is how to set the baud rate of the terminal serial monitor?

ivers:
Got this thing working. Great work!
My only problem is how to set the baud rate of the terminal serial monitor?

By default, 9600.

For another speed, see the screen documentation by typing on the Terminal

man screen

Please find a new release of embedXcode:

embedXcode • May 28, 2013 release 52 • Project configuration stability enhancement

It appeared the tool in charge of configuring the project generated zombies, resulting in a cryptic Segmentation fault: 11 error message. The cause has been fixed and zombies are over now.

More important, I'm going to resume playing with boards, sensors and displays. As my current Mac no longer provides enough power to run Xcode smoothly,

I plan to update my old Mac for a new one, as this year's target for contributions. Obviously, I continue to maintain and support embedXcode.

As always,
• Website: http://embedxcode.weebly.com
• Download: http://embedxcode.weebly.com/download
• User guide: http://embedxcode.weebly.com/tutorial

Enjoy :slight_smile:

Zulkarnine has posted a nice video about Setting-up embedXcode for Arduino, development in Mac using Xcode IDE on YouTube.

Watch it at - YouTube

Thank you Zulkarnine :slight_smile:

You are welcome :slight_smile: :slight_smile: :slight_smile:

avenue33:
Xcode code-sense doesn't seem to be powerful enough to manage virtual functions within classes. Serial.print() is a virtual function.

Yes. One should not forget that Apples does not care too much about C++ in Xcode. Xcode is mainly made for C and ObjC. Although they try to make a decent C++ compiler, proper C++ code sense is clearly not their top priority.

Ferio:

avenue33:
Xcode code-sense doesn't seem to be powerful enough to manage virtual functions within classes. Serial.print() is a virtual function.

Yes. One should not forget that Apples does not care too much about C++ in Xcode. Xcode is mainly made for C and ObjC. Although they try to make a decent C++ compiler, proper C++ code sense is clearly not their top priority.

I more than agree with you! Xcode is aimed at OS X and iOS.

Now, I'm not tied to Xcode and can consider another IDE. The tests of the makefiles were successful with NetBeans.

I only need some help from someone knowing NetBeans well.