Arduino Tutorial - How the code structure works

Would you like to help?
Share your walkthrough tutorial with others
User avatar
Posts: 5361
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Mar 12, 2014 7:04 pm
Essentially. Those files are considered the "Libraries"
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu Mar 13, 2014 5:52 am
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

Posts: 62
Joined: Mon Feb 24, 2014 9:38 pm
Location: Sydney, Australia
PostPosted: Thu Mar 13, 2014 3:34 pm
Thanks Colin, appreciate your help!
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu Mar 13, 2014 8:59 pm
You're welcome!

Posts: 16
Joined: Tue Feb 25, 2014 8:38 pm
PostPosted: Mon Mar 17, 2014 9:15 pm
Very Helpful, thanks a lot

Posts: 14
Joined: Thu Apr 04, 2013 6:11 pm
PostPosted: Wed Apr 02, 2014 4:36 pm
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.

Posts: 12288
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Apr 02, 2014 4:40 pm
Start here:
http://arduino.cc/en/Hacking/LibraryTutorial
Roberto.

Posts: 14
Joined: Thu Apr 04, 2013 6:11 pm
PostPosted: Thu Apr 03, 2014 4:28 pm
Thanks Roberto!!!!

Posts: 1
Joined: Wed Feb 08, 2017 7:20 pm
PostPosted: Thu Feb 16, 2017 7:07 am
Thank you for this tutorial! It has helped me to understand tremendously...since I am a absolute newbie to programming. ;)
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu Feb 16, 2017 7:15 am
Glad it helped!

--Colin
Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron