The Arduino Environment
The Arduino Environment
Code
http://arduino.cc/en/Reference/HomePage
1
4/17/2019
Comments Comments
2
4/17/2019
Comments Comments
Operators Operators
3
4/17/2019
Boolean
Integer
Character
4
4/17/2019
5
4/17/2019
Setup
Setup
void setup ( ) {
void setup ( ) { }
pinMode (13, OUTPUT); }
The setup header will never change, Outputs are declare in setup, this is
everything else that occurs in setup done by using the pinMode function
This particular example declares digital pin # 13 as an
happens inside the curly brackets output, remember to use CAPS
6
4/17/2019
7
4/17/2019
If Conditional
if ( this is true ) { do this; } if ( this is true ) { do this; }
8
4/17/2019
Action Else
if ( this is true ) { do this; } else { do this; }
void loop ( ) { }
• loop
• For
• while
9
4/17/2019
The “loop” in the header is what the The “( )” in the header is where you
function is called, sometimes you make declare any variables that you are
the name up, sometimes (like loop) the “passing” (or sending) the function, the
function already has a name loop function is never “passed” any
variables
10
4/17/2019
for (int count = 0; count<10; count++) for (int count = 0; count<10; count++)
{ {
//for action code goes here //for action code goes here
} }
11
4/17/2019
for (int count = 0; count<10; count++) for (int count = 0; count<10; count++)
{ {
//for action code goes here //for action code goes here
} }
for (int count = 0; count<10; count++) for (int count = 0; count<10; count++)
{ {
//for action code goes here //for action code goes here
} }
12
4/17/2019
13
4/17/2019
Questions?
www.sparkfun.com
6175 Longbow Drive, Suite 200
Boulder, Colorado 80301
14