Variables are used to store data in a sketch/program.

A variable holds data in a sketch/program. For example, a program might store the result of an analog-to-digital conversion in an integer variable:

int val = analogRead(2);

In this case, a variable named val is being declared with type int (integer). It is being initialised to contain the result of a call to analogRead().

Other common variable types can include float, char, long, and pointer, among others.

Variables are technically distinct from objects (instances of a class/struct), but they are largely handled in the same way.

Use this tag for Arduino programming issues which specifically relate to the use of variables. This is likely to be quite rare, so please consider that there may be a more suitable tag, such as .