Programming language

Hello. I am quite new in Arduino. I have a question.

Can I use sketch/program originally written in C or C++ programming language in Arduino? Are those languages fully compatible with Arduino? Thank you very much.

Are those languages fully compatible with Arduino?

Yes and no

The Arduino IDE uses the setup() and loop() functions to make coding easier. Behind the scenes there is a hidden main() function that repeatedly calls loop(). If the C or C++ program that you want to use has its own main() function then it will be used in preference to the hidden one but the Arduino initialization function will not have been called to set up the hardware environment.

Don't forget that the Arduino has no standard IO capability and normally uses the Serial monitor or a terminal emulator to communicate with the user. Most C and C++ functions will work if enough memory is available but some, such as support for floats in sprintf(), have restrictions.

What sort of program do you want to run bearing in mind the restrictions of the Arduino environment ?

Thank you very much UKHeliBob. But what if I would use C and C++ functions inside void setup () and void loop ()? As I understand I should not disturb main structure of Arduino. Is it possible? Actually friend of mine has good skills in C and C++ programming languages. We are thinking about making team and create cool Arduino projects. We don't make agreement yet about what to do. We are probing ground actually.

You write your function definitions outside of setup() and loop(). The IDE looks after prototypes for you. You call your functions from within setup and loop.

The IDE comes with quite a few examples to help you learn control and programming.

http://www.arduino.cc/en/Tutorial/Foundations

.

Thank you LarryD

But what if I would use C and C++ functions inside void setup () and void loop ()?

as I said

Most C and C++ functions will work if enough memory is available

So functions such as atoi(), strcmp(), strtok() etc etc will work.

Thank you very much. Regards.