Go Down

Topic: What is Arduino exactly? (Read 945 times) previous topic - next topic


Apr 04, 2012, 07:30 am Last Edit: Apr 04, 2012, 07:57 am by cjdelphi Reason: 1
I've seen C++ and C mixed together while coding in Arduino.

So is Arduino the IDE? and the language is C part C++

meanwhile check out my crappy weather station  I've just finished writing, i use a BOSH BMP085 sensor with Wiznet to deliver a basic weather station

(South Australia, Adelaide, Clearview)
http://www.weatherzone.com.au/sa/adelaide/clearview   (official info to compare to)

So what am i coding in? hybrid C/C++ ?


C++ is a superset of C. The language of Arduino is C++.

Morris Dovey

Craig - It's working. Consider adding a location; weather info for 'noplace in particular' isn't very useful. :)

Unless you cause it to behave differently, the Arduino IDE compiles your code as C++.
There's always a better way!


lol, the location is my bedroom, um South Australia (Adelaide) :P - but...

the question was, and you've answered it, C++ - i'll be honest i hate C++ as long as i get away with C (on the whole) looking code i'll be happy, my first program i wrote
was written in C when i was 8 (22 years ago) and i like C, not C++ i used Object Pascal (for objects) maybe i need to write a Pascal compiler lol..

anyway so it's C++ huh - thanks.

Nick Gammon

Somewhere in South Australia, I am guessing. Based on the 240V and the IP address.

Oh, and the temperature. It's 29C in Adelaide apparently, whereas it's a bit cooler where I am.

Look for the house with the bedroom light off.

(edit) ninja'd!  But I worked it out before he posted.


lol, the bedroom light is a Cree 3 watt LED underdriven via a PNP 2222a transistor :)  and a 5v linear regulated supply :P

Yeah well, it is 3:39pm light will be off :)  lol - so can i say i code in C++ even though it looks identical to C? lol

Nick Gammon

You can say that if you want to.

A reasonably simple program in C++ will look the same as one in C. Well, put it this way, with some restrictions the same code will compile in C and C++.

But if you are doing this, for example:

Code: [Select]
Serial.println ("hello");

Then you are using C++.

Serial is an instance of the class HardwareSerial, and you are calling a member function of that instance.

And classes are a C++ thing. :) 

Sorry to disappoint you.


awwww, yeah you're right Serial. <<object :(

grrrrr lol


can i say i code in C++ even though it looks identical to C?

I am capable of writing C programs in several languages.  C, C++, Java, Perl, ...  :-)


Apr 04, 2012, 09:16 am Last Edit: Apr 04, 2012, 09:19 am by cjdelphi Reason: 1
I've grown up on a diet of Pascal and Object Pascal, C++ (objects look scary) but C i can handle, PHP i can handle, C++ and objects that look like object::fsdfsdf scare me :P

 Writeln('Please no C++');


 echo "Please no C++ \n";


printf(" Really no!");

lol, it's not that i don't like C++ just that i've been spoilt with objectpascal


Code: [Select]

S: String;
Key,B: Byte;
N: Integer;
For N:=1 to Length(S) do
   B:=B Xor Key;

for (n=0; n<StrLen; n++)
 int b = 0;
 int key = 55;

//  B:=Ord(S[N]);  //ord is the Decicmal of Ascci value, eg, A = 65; so abcde becomes 65 66 67...
 //  B:=B Xor Key;  // xor 55 with 65 (A or whatever)
  // S[N]:=Chr(B);  //replace string back with the XOR'ed version


how would you do that in C/C++ ?  

The 'English' descriptions  Begin End; XOR, it's all pretty much explained to you as you code, where as with C++ you have to remember so very specific info - i'm spoilt lol

Nick Gammon

I know exactly what you mean. I spent 10+ years programming in Turbo Pascal. C seemed really strange at first. But, you adjust ...


If you can handle C as you say, then what makes C++ so scary? Its not as bad as you think. I don't think its bad at all.


Almost seems like BASIC with semicolons & { }s at this point.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up