Is coding the Arduino way going to get limiting in my future?

I'm an experienced embedded software engineer (Pic/Atmel) that has decided to take up the Arduino for hobby projects and to learn electronics.

What I'm wondering though, is:

  • Whether to start using Atmel Studio 6 from the outset (not my normal IDE), or use the Arduino IDE.
  • Whether I have to (should) use the whole setup() loop() & Arduino libraries.

I've read that using the Arduino IDE and using the Arduino codebase/libraries can be 'limiting' once you advance. Is this true?

Can I mix & match code? Could I use an Arduino library for say, TCP Stack, and low level C-code my timers & serial interface?

If I use any of the Arduino library methods, do I have to use the setup()/loop() methods, or can I just create a standard c-style project with void main()?

What constraints does the Arduino way of coding put on me?

What constraints does the Arduino way of coding put on me?

You're a psychic, and you're asking us?

Whether to start using Atmel Studio 6 from the outset (not my normal IDE), or use the Arduino IDE.

Use the IDE until you find issues with it.

Whether I have to (should) use the whole setup() loop() & Arduino libraries.

Have to? No. Should? Yes.

The tasks to be performed on the Arduino lend themselves to setup stuff and stuff to do over and over. Why not fit the normal structure?

I've read that using the Arduino IDE and using the Arduino codebase/libraries can be 'limiting' once you advance. Is this true?

Rubbish. You may find that the IDE doesn't suit you after a while, though I still use it. The Arduino code and libraries you will continue to use, unless you like reinventing the wheel.

Can I mix & match code?

You can. But, does it make sense?

Could I use an Arduino library for say, TCP Stack, and low level C-code my timers & serial interface?

Yes, but again why? The serial interface already exists. Why reinvent it?

If I use any of the Arduino library methods, do I have to use the setup()/loop() methods

No. The use of a library does not tie you to setup() and loop().

I have never been keen on using black box library code. I don't know what's going on inside it, and I can't tailor it to my own design, and I learn nothing from it. For those reasons I am far more comfortable writing/using my own code as I learn far more, understand more, and have more knowledge to debug with. I dislike Java for the same reasons :wink:

And, for many areas, it wouldn't be reinvention. I already have a lot of code that I've written over the years to perform various tasks that is fully customizable. And either way, I get far more satisfaction from writing it all myself. Maybe it's the control freak in me! :slight_smile:

And, if there are going to be future issues or limitations with an IDE/codebase, I'd rather know about them from the outset, rather that possibly wasting time and having to relearn a newer IDE if the first is limited. AS6 is going to have a bigger learning curve, but if I'm going to end up there anyway, I may as well start early. But with no knowledge on the Arduino IDE/code libraries I have no way of making an informed decision, hence my question here. I'm just looking to find out what problems I may face with it all for larger, more complex projects.

The Arduino uses C++ as its programming language. The built in functions such as analogRead(), digitalWrite(), and standard libraries such as hardware Serial make it convenient to use but you don't have to use them if you don't want to.

The libraries are supplied as source code, so there's nothing 'black box' about them.

The IDE doesn't do much, so learning it should cost you no more than 15 minutes - if that.

Given those things, I'd suggest that you use the IDE for now until you find it doesn't suit your needs as at that point you'll have a much clearer view of what it is you really need.

As a software engineer you must be comfortable using black box code or you'll never get anything done :wink: After all you build software as several layers of abstractions. Sure it's nice to be able to open the boxes if you have to and I believe it's possible with Arduino in the same way as for any other platform. I feel that since coding for Arduino is just C++ this knowledge is mostly transferrable to other platforms as well (say Rasperry Pi). Sure you'll have Arduino specific functions/variables, but bulk of the work is "platform agnostic".

I have been using both the AS6.X IDE and Arduino, depending on the project at work. Each has its advantages and disadvantages. I use Arduino for simple tasks that need to be done quickly and the IDE for developing our primary firmware on a non-arduino based product. Arduino has some specific limits on how it wants to do things, but for the most part is a very quick and easy way to set up some rather complicated things (IE Communication Protocols), though you have less knowledge of the exact process without doing some research (IE going and looking at the code). The AS IDE is a good IDE for coding, but Atmel is only now is developing a library of pre-generated code to help you along with particular tasks (ASF), though I have mixed feelings about that as well and it feels like you need to start the project using ASF. However, any code you can write in AS you can write just almost as easily write in the Arduino IDE, with the exception of #define'd bit names (Which I personally don't even like very much). However, if you are worried about doing something like optimizing the code to run as quickly as possible, then I would not use the internal Arduino libraries and write your own.

Start with the Arduino IDE, go to other tools if it becomes limiting. Can't say that's happened to me yet, although I've used WinAVR and to a lesser extent, AS6. Programming can be done as close to the hardware as desired with any of those. Libraries can be used or not. Practically, I can't expect to reinvent all the wheels, although I certainly do enjoy reinventing a few for the reasons you mentioned. So I usually end up with a combination. Often, if I am adding some peripheral hardware, I will write my own library even though I'm sure I could find multiple examples out there.

A recent project used four of my own libraries, one from the Arduino playground, one of the libraries included with the Arduino IDE, two from elsewhere around the web, and two of the base AVR Libc libraries. Plus some of the standard Arduino stuff like Serial.

I'm coming at the Arduino from the hardware side.
I only use a couple of libraries:
Serial, SPI, Wire.
and some of the macros/functions on the Reference page.
Outside of that, I write my own inline code to make external hardware do what I want.
I also don't do a lot of data processing, maybe if I had to do more of that then other libraries would be handy.
The IDE is very handy for that, and also providing an easy path to installing bootloaders, and sketches that are portable across the processor types that I use - '328P, '1284P, '2560.

I have been programming on Visual Studio on PC/consoles quite long time. I wonder if you could use it also for Arduino development. It's pretty powerful IDE. Would be nice to be able to debug as well via VS but maybe that's too much to ask (:

Psychic:
What constraints does the Arduino way of coding put on me?

No constraints that I am aware of. You are basically coding in C++ using the GNU compiler. Can't get much more industry-standard than that, excepting maybe Objective C, and only Apple really uses that, as far as I know.

Since all the library source is supplied you can find out what it does, and either work within that, or copy and adapt it.

I have seen ports of the STL (standard template library) which lets you do sophisticated things like maps/lists/vectors of any (reasonable) type.

You can access hardware registers if you need to, or want to.

Personally I use the built-in IDE. It works well enough that its fairly minor limitations don't annoy me. If I need to I use other tools to edit library code, ones which support regular expressions for example.

I have never been keen on using black box library code. I don't know what's going on inside it, and I can't tailor it to my own design, and I learn nothing from it.

Well, I guess it's a good thing that the arduino libraries are included in source form in every arduino distribution, so that you can look at them, learn from them, and tailor them to your own design (if you really want to.)

The Arduino libraries seem to be rather less "black box" than ASF, for instance...