Arduino C - this will be my journey trying to build something useful

I am planning to control my Philips Hue using Arduino and XBee. As far as I could read it’s more difficult to get Python scripts running directly on the Arduino.
So this is a good excuse for me to dive more into C.
I am 2 days in Arduino C - Found a book on safaribooksonline - Beginning C for Arduino: Learn C Programming for the Arduino, Second edition by Jack Purdum.
It is good because it targets beginners.
I am pretty sure I am not losing my time learning this stuff, it is actually fun.
It is something that helps me practice what I learn in LCTHW.
I know by now that I have a weakness for understanding how things work low level.
Here’s a small quote:

The C you are about to learn is not standard C. Instead, you will be learning an almost complete subset of standard C. The flavor of C used by the Arduino IDE is missing several elements of standard C (e.g., the double data type), but the absence of those features is not a crippling blow by any means. You will soon discover that the subset version of standard C, which we will call Arduino C, is more than able to perform just about any task you can throw at it. The missing features can usually be worked around, albeit sometimes in a less elegant manner.Another difference between Arduino C and standard C is that the underlying compiler for Arduino C is actually the Open Source C++ compiler. As such, you will discover that most of the libraries used with the Arduino IDE are written using C++. This means that, even though you are writing your programs in Arduino C, much of the glue holding things together “under the hood” is written in C++. Indeed, you are free to mix C with C++ in the Arduino IDE. Still, we concentrate on Arduino C in this book, even though we have added a chapter near the end of the book to give you a light introduction to C++. So, from this point forward, when I write about the C language, I am actually referring to C as it is implemented in the Arduino IDE.

Nice, C is a good language to learn if only to learn the semantics and terrible things that C has brought to other languages. Once you learn C you’ll know the basics of a whole class of languages that inherit from it, and you’ll be able to do cool embedded stuff.

1 Like

Something to never forget or confuse: defining and declaring are entirely different animals.
When I declare a variable it has no lvalue. It is like a blue print that sketches out a few attributes, but there is no memory allocated yet to it.
When I define a variable, the compiler finds me the bytes needed for that data type and reserves them for that variable. It now has an lvalue.


Ok, today was discouraging: had to light 2 LEDs at different times. Didn’t have the LEDs and had to use a 7 segment display with 4 digits.
I am a total noob in electronics. I have to learn stuff about circuits.

Making progress, I could finally light 2 leds on my display and understood how they have a common annode.
Found some useful info here:

And also this is a good place to be, because you can simulate and arduino + breadboard online, before trying everything live:

I understood something important: there are so so many useful things one can do with programming + electronics!
Who said there’s nothing creative in it?

YEY!!! Victory!
I finally understood what I was missing. I will always read the datasheet for 7 segment display, especially when they are 2 or 4 digits…

1 Like

You seen this?

1 Like

Interesting, haven’t seen it, thank you!