Arduino Tutorial - How the code structure works

Would you like to help?
Share your walkthrough tutorial with others
Post Reply
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Arduino Tutorial - How the code structure works

Post by lnevo »

Essentially. Those files are considered the "Libraries"
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Arduino Tutorial - How the code structure works

Post by cosmith71 »

wolffman64 wrote:Hi Colin,

Thanks for the great write up, now I understand the basic part of it.
One question I have is regarding the first "include" part. I assume that those are the files that are unique for the RA, and defines how they are all wired into the arduino board etc, and what kind of input/output/variables you get from each function. Are they described in any more detail anywhere, for instance the "tempsensor" file, what is coming out of it etc, or have I completely misunderstood this?
The #include statements essentially add standard code for doing stuff into your sketch (libraries, as Lee said). Instead of having to put a bunch of code into every single sketch to handle temperature sensors, we just #include a standard file that does it. It makes the sketch tidier and much easier to read and deal with.

The libraries are generally located at c:\Users\xxxxxx\Documents\Arduino\libraries, where xxxxxx is your user name. You can view them with any standard text editor (like notepad). There are .h files and .cpp files. The .cpp files are a little more interesting to look at and make more sense to the lay person.

Here is a good reference as well:

http://www.easte.net/RA/html/index.html

Hope this helps!

--Colin
wolffman64
Posts: 62
Joined: Mon Feb 24, 2014 9:38 pm
Location: Sydney, Australia

Re: Arduino Tutorial - How the code structure works

Post by wolffman64 »

Thanks Colin, appreciate your help!
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Arduino Tutorial - How the code structure works

Post by cosmith71 »

You're welcome!
SEANTADEZ
Posts: 16
Joined: Tue Feb 25, 2014 8:38 pm
Contact:

Re: Arduino Tutorial - How the code structure works

Post by SEANTADEZ »

Very Helpful, thanks a lot
snoopy60
Posts: 14
Joined: Thu Apr 04, 2013 6:11 pm

Re: Arduino Tutorial - How the code structure works

Post by snoopy60 »

Thanks so much, this is fantastic. I am having a ball studying this "tutorial".
Question: looking at the library on my c drive, I see the many of the folders have a CPP file and an H file. Are these interchangeable? Why the different files?
Just the beginning of learning this stuff, but what a great start.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Arduino Tutorial - How the code structure works

Post by rimai »

Roberto.
snoopy60
Posts: 14
Joined: Thu Apr 04, 2013 6:11 pm

Re: Arduino Tutorial - How the code structure works

Post by snoopy60 »

Thanks Roberto!!!!
User avatar
ffitch63
Posts: 1
Joined: Wed Feb 08, 2017 7:20 pm

Re: Arduino Tutorial - How the code structure works

Post by ffitch63 »

Thank you for this tutorial! It has helped me to understand tremendously...since I am a absolute newbie to programming. ;)
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Arduino Tutorial - How the code structure works

Post by cosmith71 »

Glad it helped!

--Colin
Post Reply