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 #19 background imageLoading...
Page #19 background image
19
7.4 Math
The Arduino can do standard mathematical operations. While floating point (e.g. 23.2) numbers
are allowed if declared as floats, operations on floats are very slow so integer variables and
integer math is recommended. If you have byte variables, no number, nor the result of any math
operation can fall outside the range of 0 to 255. You can divide numbers, but the result will be
truncated (not rounded) to the nearest integer. Thus in integer arithmetic, 17/3 = 5, and not 5.666
and not 6. Math operations are performed strictly in a left-to-right order. You can add parenthesis
to group operations.
The table below shows some of the valid math operators. Full details of their use can be found in
the Arduino Language Reference.
Symbol
Description
+
addition
-
subtraction
*
multiplication
/
division
%
modulus (division remainder)
<<
left bit shift
>>
right bit shift
&
bitwise AND
|
bitwise OR
8 The Simple Commands
This section covers the small set of commands you need to make the Arduino do something
useful. These commands appear in order of priority. You can make a great machine using only
digital read, digital write and delay commands. Learning all the commands here will take you to
the next level.
If you need more, consult the Arduino language reference page at h
http://arduino.cc/en/Reference/HomePage.
pinMode
This command, which goes in the setup() function, is used to set the direction of a digital I/O pin.
Set the pin to OUTPUT if the pin is driving and LED, motor or other device. Set the pin to
INPUT if the pin is reading a switch or other sensor. On power up or reset, all pins default to
inputs. This example sets pin 2 to an output and pin 3 to an input.
void setup()
{
pinMode(2,OUTPUT);
pinMode(3,INPUT);
}
void loop() {}
Serial.print

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