Go Down

Topic: Visual examples (Read 675 times) previous topic - next topic

Race_Bannon

Hello,

     I am new to Arduino, I have a base knowledge of electricity and a little more experience programing.  Currently I am working through the "Begining Arduino" book. (Cant remember the name but its the blue one.)  As I am working through the examples I find my self having trouble with aspects of the code.  I tend to learn a little better visually, and I was wondering if anyone out there new of a good reference sheet or similar item, that can lay out the basics of the code structure with main functoning statements that are most commonly used?

     I am trying to take the code from past exercises and add it to the code for the next exercise etc.  I am not having success, and getting errors where there (as I understand it) should not be.  More specifically, I am aware that at the end of a code you need to end it with an  "}".    Anyway, it would be great to get some advice on where to find such a reference item.  The book doesn't have the example I thought that maybe someone else may have found.  I think I will be better off for what I hope to gain from Arduino, if I get a really firm grasp on the code early on.  Thanks for taking the time to look at my post.

James C4S

The Arudino is programmed in C/C++. A comment like "code ends in a }" suggests you need to spend some time understanding C.

You can always post code here for suggestions on how to make it compile, but please wrap that code in [ code] tags.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Morris Dovey

A very sketchy reference off the top of my head:

Function:

<type> <function name> ( <argument list> ) <block>

Block:

{ <statement> }

Statements:

<expression> ;

<block>

if ( <expression> ) <statement>

if ( <expression> ) <statement> else <statement>

while ( <expression> ) <statement>

do <statement> while ( <expression> ) ;

for ( <expression> ; <expression> ; <expression> ) <statement>

goto <label> ;

continue ;

break ;

return <expression> ;


For a more complete/formal breakdown, pick up a copy of The C Programming Language 2nd Ed by Kernighan & Ritchie or download a copy of n1256.pdf
There's always a better way!

Race_Bannon

Great!  Thanks for your reply's, this is a great starting point for me.

DuaneB

Hi,

I think this is a nice reference to have around, its the guide that oomlout supply with thier Arduino kits -

http://oomlout.com/products/ARDX/ARDX-experimenters-guide-WEB.pdf

Duane B

rcarduino.blogspot.com

Go Up