Pages: [1]   Go Down
Author Topic: Visual examples  (Read 525 times)
0 Members and 1 Guest are viewing this topic.
Seattle
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 64
Posts: 6055
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

West Des Moines, Iowa USA
Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

There's always a better way!

Seattle
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: [1]   Go Up
Jump to: