EasyManuals Logo

Arduino uno User Manual

Arduino uno
311 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 #37 background imageLoading...
Page #37 background image
Lets see how this works and dissect the programs source code piece by piece.
In the first two lines, we define two
unsigned int
constants using the
const
key-
word.
LED_PIN
refers to the number of the digital IO pin were using, and
PAUSE
defines the length of the blink period in milliseconds.
Every Arduino program needs a function named
setup
, and ours starts in line
4. A function definition always adheres to the following scheme:
<return value type> <function name> '(' <list of parameters> ')'
In our case the functions name is
setup
, and its return value type is
void
: it
returns nothing.
setup
doesnt expect any arguments, so we left the parameter
list empty. Before we continue with the dissection of our program, you should
learn more about the Arduinos data types.
Arduino Data Types
Every piece of data you store in an Arduino program needs a type. Depending
on your needs, you can choose from the following:
boolean
values take up one byte of memory and can be
true
or
false
.
char
variables take up one byte of memory and store numbers from -128
to 127. These numbers usually represent characters encoded in ASCII;
that is, in the following example,
c1
and
c2
have the same value:
char c1 = 'A';
char c2 = 65;
Note that you have to use single quotes for
char
literals.
byte
variables use one byte and store values from 0 to 255.
An
int
variable needs two bytes of memory; you can use it to store numbers
from -32,768 to 32,767. Its unsigned equivalent
unsigned int
also consumes
two bytes of memory but stores numbers from 0 to 65,535.
For bigger numbers, use
long
. It consumes four bytes of memory and stores
values from -2,147,483,648 to 2,147,483,647. The unsigned variant
unsigned long
also needs four bytes but ranges from 0 to 4,294,967,295.
float
and
double
are the same at the moment on most Arduino boards, and
you can use these types for storing floating-point numbers. Both use four
bytes of memory and are able to store values from -3.4028235E+38 to
3.4028235E+38. On the Arduino Due,
double
values are more accurate
and occupy eight bytes of memory.
report erratum discuss
Hello, World! 17
www.it-ebooks.info

Table of Contents

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