EasyManuals Logo

Arduino uno User Guide

Arduino uno
27 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #18 background imageLoading...
Page #18 background image
18
delay(1000);
digitalWrite(2,LOW); // turn LED off
delay(1000);
}
Here is the same using a symbol to define "LED"
#define LED 2 // define the LED pin
void setup()
{
pinMode(LED,OUTPUT);
}
void loop()
{
digitalWrite(LED,HIGH);
delay(500);
digitalWrite(LED,LOW);
delay(500);
}
Note how the use of symbols reduces the need for comments. Symbols are extremely useful to
define for devices connected to pins because if you have to change the pin that the device
connects to, you only have to change the single symbol definition rather than going through the
whole program looking for references to that pin.
7.3 Program Structure
All Arduino programs have two functions, setup() and loop(). The instructions you place in the
startup() function are executed once when the program begins and are used to initialize. Use it to
set directions of pins or to initialize variables. The instructions placed in loop are executed
repeatedly and form the main tasks of the program. Therefore every program has this structure
void setup()
{
// commands to initialize go here
}
void loop()
{
// commands to run your machine go here
}
The absolute, bare-minimum, do-nothing program that you can compile and run is
void setup() {} void loop() {}
The program performs no function, but is useful for clearing out any old program. Note that the
compiler does not care about line returns, which is why this program works if typed all on one
line.

Other manuals for Arduino uno

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Arduino uno and is the answer not in the manual?

Arduino uno Specifications

General IconGeneral
Form factorArduino
CertificationRoHS, FC, CE
Processor model-
Processor frequency- MHz
Microcontroller modelATmega328
Microcontroller frequency16 MHz
DC input voltage7-12 V
Operating voltage5 V
DC current per I/O pin40 mA
Flash memory0.032 MB
Maximum internal memory- GB
SRAM (Static Random Access Memory)2 KB
EEPROM (Electrically Erasable Programmable Read-Only Memory)1 KB
Wi-FiNo
Number of analog I/O pins6
Number of digital I/O pins14
Weight and Dimensions IconWeight and Dimensions
Board dimensions53.4 x 68.6 mm

Related product manuals