retrolefty:
I would recommend learning C then C++ as an easier path, but that is just how I came to know the languages. I don't try and write any C++ features in my code but of course use most of the arduino libraries that do use C++ features.
Learning a few C++ features and using them can make many coding jobs far neater/easier/safer.
eg. An RGB LED. If you've got several of them attached it makes far more sense to create a LED 'object':
class RGB_LED {
byte reg,green,blue;
void setBrightness(byte b) {
}
void setHue(int h) {
// Set the color using a 'hue' value...
}
...etc.
};
// Then you can have lists of them
RGB_LED frontLeds[8]; // 8 RGB leds at the front
RGB_LED rearLeds[8]; // 8 RGB leds at the rear
How would you write that in C?
byte frontLeds[8][3]; // 8 RGB leds at the front
void setHue(byte led[], int h)
{
// .. ?
}
Surely that sort of pointer manipulation isn't something we should encourage when you're using a C++ compiler.