Maker Pro
Maker Pro

Question concerning Arduino and C++

Hello friends.
I am new to programing and microcontrollers in general. I had no knowledge of C language until I recently found some very useful YouTube lessons about C language and how to build a small program on PC with it. After watching the lessons i managed to understand the very basic concepts of the language (what is a variable, an array, a function etc). I bought an arduino uno and a mega board and I started playing with them. I have come to realize that I need not only C language but also C++. I found C++ lessons again aimed for pc programming and I have to admit that it is very very hard for me to understand what is going on. I intend to watch all the lessons and then move to practice C++ on the arduino. So could anyone suggest me which parts of the C++ language concerning the arduino should I focus after finishing the lessons ?

Thank you !
 
You do realise it is not necessary to know C or C++ to program Arduino.

There is a much bore basic approach and for the most part will get you to the same end in a much easier shorter time.
 
You do realise it is not necessary to know C or C++ to program Arduino.
There is a much bore basic approach and for the most part will get you to the same end in a much easier shorter time.

Actually i had no idea that one can program an arduino without C or C++. Could you explain more please ?
 

Harald Kapp

Moderator
Moderator
There is a much bore basic approach and for the most part will get you to the same end in a much easier shorter time.
Which approach do you mean?

Actually i had no idea that one can program an arduino without C or C++. Could you explain more please ?
Constantin, you could use assembler. Although I will not recommend this as a starting point. An arduino sketch is a program based on C/C++. The language may seem to be more difficult to learnd than say e.g. Basic, but is rather hardware-near and thus well suited for embedded programming. For your first starter programs you will have little contact with the C++ side of a sketch. This will become more and more relevant once you start using classes from libraries or even write your own classes.
My tip: Do not dive too deep into general C++ programming literature as it will present you with examples and code that are mainly relevant for PC programming, not for embedded programming. Concentrate on arduino-specific literature instead. Tutorials and sample programs can be found by the dozen on the internet.
 
My tip: Do not dive too deep into general C++ programming literature as it will present you with examples and code that are mainly relevant for PC programming, not for embedded programming. Concentrate on arduino-specific literature instead. Tutorials and sample programs can be found by the dozen on the internet.
Yes, that's exactly my point Harald. Though in my opinion finding tutorials that are easy to understand by a complete newbie is not very easy. Thats why i think it would be better to finish the lessons ive downloaded first.
 
Last edited:
general C++ programming literature as it will present you with examples and code that are mainly relevant for PC programming
The last lesson i watched today was about (classes and arrays) also (classes and const) not to mention the last one that was about classes, arrays and pointers combined...
Total brain burnout for me :confused:

And im not even close to hearning inheritance.
 
Go to the Arduino page, download and install the IDE, run down the list of example sketches and you'll soon see.
From the above I think you are trying to jump in at the deep end.
Start simpler......
Best to get a couple of boards etc. to play with as you'll pick it up more quickly.
Using clone boards from China is a way of doing it much more economically and they work just fine.
There is an excellent support forum to answer your question also. Just remember to include as much info as possible.

https://www.arduino.cc/en/main/software

Watching some videos also helps.

Jeremy Blum ..... https://www.youtube.com/results?search_query=jeremy+blum+arduino

Ralph Bacon ...... https://www.youtube.com/channel/UC8Ob-HnnmhlgSv5Vs_i32TQ/videos

Julian Ilett ............https://www.youtube.com/user/julius256/videos
 
I have already purchased an uno and a mega board (both clones) i love the mega board because it also comes in small form factor plus it has bigger memmory and 4 UART's. I have been working on a small project of mine that involves GPS receiver where the mega board reads the serial stream from, stores it in a char array and does some calculations. It took me 8 months to complete with lots of help from arduino forum.
What drives me to learn C++ is the fact that all serius programs ive seen online (from github for example) use C++ and i really dont understand a single line. Even my code uses a little C++ (booleans for example).
 
I have already purchased an uno and a mega board (both clones) i love the mega board because it also comes in small form factor plus it has bigger memmory and 4 UART's. I have been working on a small project of mine that involves GPS receiver where the mega board reads the serial stream from, stores it in a char array and does some calculations. It took me 8 months to complete with lots of help from arduino forum.
What drives me to learn C++ is the fact that all serius programs ive seen online (from github for example) use C++ and i really dont understand a single line. Even my code uses a little C++ (booleans for example).

Yes, I understand exactly where you are coming from.
Most of my applications, although variable in nature, usually are a combination of many different operations.
Most are covered quite well by the Arduino pro mini.
I tend to learn as I go, so to speak, where I don't bother too much with a wide knowledge base, rather, apply each section as I have a use for it.
I think many operate in a similar manner.
This is one of my commercial designs.
 

Attachments

  • image2.JPG
    image2.JPG
    68.7 KB · Views: 13
  • IMG_9447.jpg
    IMG_9447.jpg
    356.6 KB · Views: 13
Neat design ! Congrats. I have a few pics of my own project to share with you. Still i would like to learn the basics of C++ to be able to put them to use in the future.

Pic 1 and 2 are the PCB's
Pic 3 is an smd chip being tested by me soldered on a custom adapter board for the breadboard.
Pic 4,5,6 are all the boards "sandwitched" together to minimize space and eliminate the need for extra wires.
 

Attachments

  • 1.jpg
    1.jpg
    346 KB · Views: 13
  • 2.jpg
    2.jpg
    396.5 KB · Views: 12
  • 5.jpg
    5.jpg
    195.1 KB · Views: 13
  • 6.jpg
    6.jpg
    197.6 KB · Views: 14
  • 3.jpg
    3.jpg
    280.5 KB · Views: 11
  • 4.jpg
    4.jpg
    294 KB · Views: 11
Last edited:

Harald Kapp

Moderator
Moderator
Still i would like to learn the basics of C++
Do you have any specific questions?
Apart from the object oriented extensions C++ is very much like C. As a matter of fact, when C++ was created it was, as far as I know, first only a preprocessor to convert C++ code into ordinary C code.
 
Do you have any specific questions?
Apart from the object oriented extensions C++ is very much like C. As a matter of fact, when C++ was created it was, as far as I know, first only a preprocessor to convert C++ code into ordinary C code.
Well like in post 1, i dont have a specific question just general advices if someone knew which parts (that apply to pc's) i should not pay too much attention.
 
Good work on the pcb's.
A little bit of undercut but not bad all the same.
I tend to use a protective spray after the board is completed.
If it looks like it will be more than a couple of hours exposed, I spray it and the product below allows one to "solder through" later.
https://www.jaycar.com.au/circuit-board-lacquer-spray-can/p/NA1002

Boards in my pics came from Chinese pcb maker @5 for $2.00. ( postage was $35 but it made the job considering it was for commercial)
 

Attachments

  • pcbLacquer.jpg
    pcbLacquer.jpg
    103.3 KB · Views: 0
I guess my only additional comment that I did not notice made goes like this.
C++ is different. It is object oriented.
It is possible and often done to programme C language things in C++ syntax.
But, the strength of the language over C is objects.
You might want to find some tutorials on object oriented programming (using C++) to get clear on the change in ways to do things.
Apologies if stated above that I didn't notice.
 
It is possible and often done to programme C language things in C++ syntax.
And vice versa.

You are right. Actually i am begining to understand the major differences between procedual programming and object orieted. My doubt is which parts (C++) only concern Computer programming and do not concern micro controller programming so that i can focus on micro controllers.
 
Top