What are variables in Arduino programming?

Variables are the building blocks of any programming language. These are small storage units dynamically created to store pieces of data in the microcontroller’s memory during Arduino programming. If you are a beginner or if you know how to program, this tutorial will help you become an expert in using Arduino variable types.

Though the Arduino programming is very similar to C / C++ it has some important and additional functionality to interact with its hardware board and other common electronics components.

Here you can discover all the Arduino variables, specifications, its’ limitation, and how to choose the right variable types for your Arduino projects.

Arduino Data Types


Int is the most commonly used numerical data type with 2 bytes (16-bits) of data. It is used to store numerical values only and it has ranged from -3276 to 3276 (minimum value of – 2^15 and the maximum value 2^15)

Example: Int ledPin = 13;

Here the ‘ledPin’ is the name of the variable and the digital pin number 13 has been assigned to the variable ‘ledPin’. The ‘ledPin’ variable consists of 2 bytes (16- bits) of integer data and can store both the positive and negative values.

Unsigned Int data type

Unsigned Int is also a numerical data type that consists of two bytes of storage. It is almost similar to the int data type but it differs in the following way:
• It can store only positive values.
• It has a range from 0 to 65535

long data type

The long data type consists of four bytes of storage that represent a very large range of data and stores both the positive and negative values. It has a range starting from –2147483648 to 2147483647.

Unsigned long data type

Unsigned long consists of 4 bytes of storage units and come under the numerical data type in Arduino programming. Its range is very large and can store only positive values up to 4294967295.


float data type

The float data type is special that can store numbers with fractions. This type of data is used for real-time measurements and can store a large range of values from 3.4028235E+38 to – 3.4028235E+38.

Double data type

Double is just similar to float data types in Arduino. It consists of 4 bytes and can be used for large range values.

Boolean data type

Boolean is a data type that needs only one byte of storage and is used to store 0 (false) or 1 (true) that represents true and false values.

Newsletter Signup Form

char data type

char data types consist of 1 byte of data that can store alphabets, numbers, and special characters. It has a range from –128 to 127 and represents a single character and also represents a signed value between –128 and 127.

byte data type

byte data type needs one byte (8 bits) of a storage unit and it can store values from 0 to 255 which is similar to char data types, but for unsigned values.

String data type

String data types represent arrays of chars (characters) typically used to contain text.


The void data type is used only in function declarations where no value is returned.