Arduino Reference

These are the basics about the arduino language.

Program Structure

Arduino programs can be divided in three main parts:

Variables

Variables are expressions that you can use in programs to store values, like e.g. sensor reading from an analog pin. They can have various types, which are described below.

Functions

Digital Pins

Analog Pins

Serial Communication

Handling Time

Constants

Creating New Functions

Defines

You can define constants in arduino, that don't take up any program memory space on the chip. Arduino defines have the same syntax as C defines:

#define constantName value

Note that the # is necessary. For example:

#define ledPin 3

The compiler will replace any mentions of ledPin with the value 3 at compile time.