Tuesday, March 10, 2009

Model For Female Art Students

0-4-The structure of a program. The 3-

The basic structure of programs Arduino is pretty basic and consists of at least two parts. These two parties, or functions are enclosed in blocks of statements.

Void setup () {

Instructions }

Void loop () {

Instructions}

Setup (), is the preparatory and loop () is the program itself. are needed for both functions responsibilities for executing the program.

After setup function must be the declaration of any variable at the beginning of the program. This is the first instruction to execute, you do only once and used to initiate the serial communication, to declare pin input and output and declare the necessary variables.

instruction is followed loop that includes the program code to be executed, reading inputs, outputs activating, etc.. This function is the core of any program Arduino and contains all the instructions work.

Setup ()

This statement is executed once when the program starts. Should be included in all programs but there are no variable declarations.

Loop ()

After call setup function performs a running loop allowing to load, respond and control the Arduino plate.


A typical example is that of an LED parpadenado in official page of arduino can find several, but before you start the program in detail you can see its structure: HERE

As you can see there are no bookstores as standard C (stdio . h, Coni . h. ..) since it sorftawe the internal leads.

also recommended, as any program in C, write comments and we will be more easily modify the program if necessary.

Another recommendation is to, as shown in the example program, named after the pin , ie if pin 13 is led drive a green, instead of writing
digitalWrite (13, HIGH ), we can more easily write digitalWrite (green indicator , HIGH ), where green indicator is assigned as a 13 in the beginning of the program.





0 comments:

Post a Comment