Go Down

Topic: How do I use AVR studio? (Read 3 times) previous topic - next topic

techx

I want more functions than just void loop and void setup.

I want to program in pure c or c++...

I'm wondering why this isn't documented anywhere...

mikalhart

#6
Oct 06, 2008, 04:14 am Last Edit: Oct 06, 2008, 04:16 am by mikalhart Reason: 1
I wish the documentation was more clear about that, too, techx.  I think a lot of C++ programmers would be attracted to this if they only knew it was C++!

Yes, you must provide a loop() and setup() function (and you can't provide a main()).  But beyond that, you can do almost anything C++ you want.  Make any functions, classes, create objects, call runtime library functions, etc. etc.  Try it!  It's all good! :)

Mikal

dcb

#7
Oct 06, 2008, 02:28 pm Last Edit: Oct 06, 2008, 02:30 pm by dcb Reason: 1
Well, it does say in the language reference that it is based on C++, as well as in the introduction page and the environment page and the build process page and probably a bunch of other pages too.

and like pretty much any language, write whatever functions you need.

But start with getting blink working, the "hello world" of microprocessors, and leverage the getting started page:
http://arduino.cc/en/Guide/HomePage

mem

#8
Oct 06, 2008, 02:58 pm Last Edit: Oct 06, 2008, 02:59 pm by mem Reason: 1
Quote
I wish the documentation was more clear about (C++)...

Given the power available under the hood, it's sometimes easy to forget that the Arduino is targeted at an audience that may not have or want computer science expertise. For those more interested in tinkering then learning a sophisticated object oriented programming language, C++ appears as more a deterrent than an attraction.

I think the Arduino documentation has it pitched just right, focus on what you can do and how to do it, and don't let the technology get in the way. For those of us that are as interested programming languages as we are in what we can make with them, discovering there's  C++ under the skin is easy to find. I do agree with Mikal that it is a pleasant and welcome surprise.

But lets be careful that we don't create an impression that any knowledge of C++ is important for making a successful arduino project.  

techx

#9
Oct 06, 2008, 11:39 pm Last Edit: Oct 06, 2008, 11:44 pm by brianfast Reason: 1
Look I asked a question:

How do I program in pure C or C++.

I do not want to write a hello world in Arduino language. I want to write a real c program with main()..

I don't need suggestions to get started with the arduino language. I have already done multiple things with it. Pretty soon I will have to program in real C++ on another project and I want to be able to use C/C++ asap.

Go Up