8/7/23, 9:40 PM Arduino Reference - Arduino Reference
PROFESSIONAL E D U C AT I O N STORE Search on Arduino.cc SIGN IN
H A R D WA R E S O F T WA R E CLOUD D O C U M E N TAT I O N COMMUNITY BLOG ABOUT
This page is also available in 2 other languages Change language English
LANGUAGE
Language Reference
FUNCTIONS
Arduino programming language can be divided in three main parts: functions, values
VA R I A B L E S
(variables and constants), and structure.
STRUCTURE
LIBRARIES
IOT CLOUD API Functions
GLOSSARY
For controlling the Arduino board and performing computations.
The Arduino Reference text is
licensed under a Creative
Commons Attribution-Share
Alike 3.0 License.
Digital I/O Time Characters
Find anything that can be digitalRead() delay() isAlpha()
improved? Suggest corrections digitalWrite() delayMicroseconds() isAlphaNumeric()
and new documentation via
GitHub. pinMode() micros() isAscii()
Doubts on how to use Github? millis() isControl()
Learn everything you need to
know in this tutorial.
isDigit()
Analog I/O
isGraph()
analogRead() Math
isHexadecimalDigit()
analogReference() abs() isLowerCase()
analogWrite() constrain() isPrintable()
map() isPunct()
max() isSpace()
Zero, Due & MKR Family
min() isUpperCase()
analogReadResolution() pow() isWhitespace()
analogWriteResolution() sq()
sqrt()
Random Numbers
Advanced I/O
random()
noTone() Trigonometry
randomSeed()
pulseIn() cos()
pulseInLong() sin()
shiftIn() tan() Bits and Bytes
shiftOut() bit()
tone() bitClear()
bitRead()
bitSet()
bitWrite()
highByte()
lowByte() Help
https://www.arduino.cc/reference/en/ 1/3
8/7/23, 9:40 PM Arduino Reference - Arduino Reference
PROFESSIONAL E D U C AT I O N STORE Search on Arduino.cc SIGN IN
External Interrupts Communication USB
H A R D WA R E S O F T WA R E attachInterrupt()
CLOUD D O C U M E N TAT I O N Serial C O M M U N I T Y BLOG Keyboard
ABOUT
detachInterrupt() SPI Mouse
Stream
Wire
Interrupts
interrupts()
noInterrupts()
Variables
Arduino data types and constants.
Constants Data Types Variable Scope & Qua
HIGH | LOW array const
INPUT | OUTPUT | INPUT_PULLUP
bool scope
LED_BUILTIN boolean static
true | false byte volatile
Floating Point Constants char
Integer Constants double
Utilities
float
int PROGMEM
Conversion sizeof()
long
(unsigned int) short
(unsigned long) size_t
byte() string
char() String()
float() unsigned char
int() unsigned int
long() unsigned long
word() void
word
Structure
The elements of Arduino (C++) code.
Sketch
loop()
setup()
Help
https://www.arduino.cc/reference/en/ 2/3
8/7/23, 9:40 PM Arduino Reference - Arduino Reference
PROFESSIONAL E D U C AT I O N STORE Search on Arduino.cc SIGN IN
Control Structure Arithmetic Operators Pointer Access Opera
H A R D WA R E S O F T WA R E break
CLOUD D O C U M E N TAT I O N % (remainder)
COMMUNITY BLOG & (reference
ABOUT operator)
continue * (multiplication) * (dereference operato
do...while + (addition)
else - (subtraction)
Bitwise Operators
for / (division)
goto = (assignment operator) & (bitwise and)
if << (bitshift left)
return >> (bitshift right)
Comparison Operators ^ (bitwise xor)
switch...case
while != (not equal to) | (bitwise or)
< (less than) ~ (bitwise not)
<= (less than or equal to)
Further Syntax == (equal to)
Compound Operators
#define (define) > (greater than)
#include (include) >= (greater than or equal to) %= (compound remaind
/* */ (block comment) &= (compound bitwise
// (single line comment) *= (compound multiplic
Boolean Operators ++ (increment)
; (semicolon)
{} (curly braces) ! (logical not) += (compound addition
&& (logical and) -- (decrement)
|| (logical or) -= (compound subtracti
/= (compound division)
^= (compound bitwise x
|= (compound bitwise o
Back to top
Trademark Help Center NEWSLETTER FOLLOW US
Contact Us
Enter your email to sign up SUBSCRIBE
Distributors
Careers
© 2023 Arduino Terms Of Service Privacy Policy Security Cookie Settings
Help
https://www.arduino.cc/reference/en/ 3/3