hello and a couple newbie questions

Hi everyone. I just got my first Arduino and I’m diving into this headfirst! I have a couple questions which I am confused about.

First off, I am confused as to whether the Arduino programming language is based on C/C++ or Java. I read that it is based on C, but also that it is based on Processing, which is based on Java.

Secondly, since memory capacity is an issue, why is there no boolean or bit variable type? At least I did not see one here: http://www.arduino.cc/en/Reference/VariableDeclaration

Thanks a lot and nice to meet you all!

Hi synesthesia, welcome to the arduino.

The documented arduino language is primarily C, but it is C++ under the covers. C itself is a subset of C++ so you can use either.

The Arduino development environment is based on the processing environment, but the programming language is not the same even though the user interface is similar. Processing sketches are coded in java.

There is a boolean type but it is the same size as a byte. Use it for clarity rather than saving ram. If you really need to be frugal with memory and have lots of bit values, you can use C bitfields.

Things like this are more for advanced users that are comfortable going directly to the C and C++ reference documents. The Arduino documentation is geared for people that may be starting out with computers and many of the more advanced C and C++ capabilities are not covered.

Have fun!

Hi mem, thanks for the reply. Does that mean I can use the OOP functionality of C++ such as classes in Arduino?

Yes you can. Indeed, the code in the Arduino distributed libraries are typically written as classes.

There are restrictions in the C++ implimentation, primarily due to the limited memory of the chip. Things like templates , new and delete are not supported.

Arduino uses the avr-gcc compiler, you can find lots of info about it in google.

Also, have a look here for some info on the arduino build process http://www.arduino.cc/en/Hacking/BuildProcess