[SOLVED] Arduino language

westfw:
"I have an Arduino-compatible board that I program in C++ using the Arduino IDE"

This is incredibly clear. :smiley: :smiley: It's too bad the Arduino web site and reference documents don't say this! It means that calling it a 'sketch' is a distinction without a difference.

Some people here have been acting like it's my fault for being confused, but it's not. The Arduino project went through the lengths of inventing the word "sketch" for "C++ program' (if your suggestion is accurate.) :-[

You write:

I have an Arduino-compatible board that I program in C++ using the Arduino IDE

But where Arduino (the project) call its IDE an IDE with built-in C++ compiler? Here is a picture on the front page:
![

How would they know that if they didn't find some simple algorithm in "Arduino sketch" they can just copy it over from C and C++? :-[

Why doesn't Arduino include any C or C++ tutorial? :-[

It seems like it is trying very hard to hide what is "under the hood." There isn't the most passing reference to it anywhere. In fact, even the word pointer or reference or stack or heap or malloc or free or class or any of that stuff is completely left out of the tutorials. :-[

I was given no indication that I was coding in C++ or C rather than just something where all the syntax guesses I made happened to work. I realize that C++ is "scary" but as someone who has programmed in C and C++ the only thing I saw was that anything I guess still worked. :-[

But the same is true of Java and Javascript. So for whatever reason, this is very poorly communicated. :-[

Plus, the language reference tells you about Goto: Arduino - Home but not classes? There isn't a single example of any talk about pointers or references or anything like that? :-[

I mean I realize that this stuff is "scary" but it makes people think that Arduino is a subset of C or C++. It lets people make sketches without ever being told they're C or C++ programmers. They never need to learn those skills. :-[

So it's a "subset" but not because of the limitations of the "language" - but rather because those things are never taught or emphasized. :-[ :-[

I'm sorry I didn't get this, but I'm a victim of the instructions, I swear! With all this talk of an Arduino language, I thought there was one!

That is the front page. I click "What is Arduino" and unfortunately, this is what I get.

Let's zoom in here:

Do you see the source of my confusion? :smiley:

If instead I click "learn arduino" I get this:

You act like it's my fault for being confused!

If you are accurate and it is correct to write:

"I have an Arduino-compatible board that I program in C++ using the Arduino IDE"

Then "Arduino software" should read differently.

Currently:

ARDUINO SOFTWARE
You can tell your Arduino what to do by writing code in the Arduino programming language and using the Arduino development environment.

Correctly:
ARDUINO SOFTWARE
You can tell your Arduino what to do by writing code in the C++ programming language and using the Arduino development environment.

And the "Learn arduino" reference I linked should, at some point, mention the word C++ don't you think? :smiley: Have a read: https://www.arduino.cc/en/Guide/Introduction

I know C++. I've programmed in C++. On Linux and Windows.

When I started programming Arduino with a friend, whenever they would get stuck I would just try writing C++. Simple things - like, "how do I check if it's odd"? I don't know try "if (value % 2)" should work, this will tell you if dividing by 2 has a remainder.

Well, everything like that that I tried seemed to work. 8) But that didn't mean to me that Arduino is C++ anymore than it means Java is C++ just because many things a C++ programmer who just guesses and tries, will happen to work. Nor is Objective-C the same as C++. Nor is Go the same as C++. But Arduino is different - it really is C++.

So it turns out that Arduino literally is C++(not some subset). Not C-like, or "like C++" or "based on C++". Literally C++. But you need to be told this. It's kind of hidden away.

At no point in the introductory learning materials do you find any reference to C++, even though it is what you are writing.

In fact, isn't this odd, considering that you could copy and paste any code from any C++ site that does some kind of arithmetic or similar?

Here is an example of low-pass filter in C:

void lowPassFrequency(double* input, double* output, int points)
{
    double RC = 1.0/(CUTOFF*2*3.14); 
    double dt = 1.0/SAMPLE_RATE; 
    double alpha = dt/(RC+dt);
    output[0] = input[0]
    for(int i = 1; i < points; ++i)
    { 
        output[i] = output[i-1] + (alpha*(input[i] - output[i-1]));
    }
}

so, assuming CUTOFF and SAMPLE_RATE are defined, that will just work the same, take two arrays and the number of points, and that's it.

But why would someone learning Arduino know that based on the sample code, since they're not even told that Arduino is C/C++? :-![

How would they know that if they didn't find some simple algorithm in "Arduino sketch" they can just copy it over from C and C++? :-[

Why doesn't Arduino include any C or C++ tutorial? :-[

It seems like it is trying very hard to hide what is "under the hood." There isn't the most passing reference to it anywhere. In fact, even the word pointer or reference or stack or heap or malloc or free or class or any of that stuff is completely left out of the tutorials. :-[

I was given no indication that I was coding in C++ or C rather than just something where all the syntax guesses I made happened to work. I realize that C++ is "scary" but as someone who has programmed in C and C++ the only thing I saw was that anything I guess still worked. :-[

But the same is true of Java and Javascript. So for whatever reason, this is very poorly communicated. :-[

Plus, the language reference tells you about Goto: Arduino - Home but not classes? There isn't a single example of any talk about pointers or references or anything like that? :-[

I mean I realize that this stuff is "scary" but it makes people think that Arduino is a subset of C or C++. It lets people make sketches without ever being told they're C or C++ programmers. They never need to learn those skills. :-[

So it's a "subset" but not because of the limitations of the "language" - but rather because those things are never taught or emphasized. :-[ :-[

I'm sorry I didn't get this, but I'm a victim of the instructions, I swear! With all this talk of an Arduino language, I thought there was one!

1 Like