When learning a new programming language, such as Arduino , you'll always find that there are different data types for declaring the variables and constants that can be used in the program. These data types vary in length and type depending on the language or platform (architecture) you're programming for, although they are often similar.
In this tutorial you will learn what these types of data are, how many there are, why they differ, etc. This way, when you write source code you will better understand what you are doing.
What are data types?
In computing, data types are attributes that indicate the kind of data being handled (unsigned integer, signed number, floating-point number, alphanumeric string, array, etc.). This also implies certain limitations or restrictions on the data, as it must adhere to a set of forms and formats. It cannot take any value, nor can it be manipulated in any way.
In the case of Arduino , this development board is essentially a small embedded computer, with an MCU or microcontroller consisting of memory, a CPU for processing, and an I/O system. The CPU contains several calculation units, such as the ALU or arithmetic logic unit, which doesn't care about the data type; it simply performs operations with zeros and ones. However, on the software side, data type matters, as the user or programmer needs to know what it is (even for the program to function correctly, to avoid overflows, vulnerabilities, etc.).
Data types in Arduino IDE

If you've already downloaded our free Arduino programming course , or if you already have programming knowledge on this or any other platform, you'll know that there are several types of data . Specifically, the programming language used by Arduino is based on C++, so in that sense it's very similar. For example, the most common types are:
- boolean (8 bit): a Boolean data, that is, logical, and that can only take a true or false value.
- byte (8 bit): can be from 00000000 to 11111111, that is, from 0 to 255 in decimal.
- tank (8-bit): This byte can contain various types of characters, such as signed numbers between -128 and +127, as well as letters.
- unsigned char (8-bit): the same as byte.
- word (16-bit): it is a word composed of 2 bytes, and can be an unsigned number between 0 and 65535.
- unsignedint (16-bit): an unsigned integer, similar to word.
- int (16-bit) - A signed integer from -32768 to +32767.
- unsigned long (32-bit): uses four bytes for greater length, being able to include numbers between 0 and 4294967295.
- long (32-bit): similar to the previous one, but can include a sign, so it would be between -2147483648 and +2147483647.
- float (32-bit): is a floating point number, that is, a number with decimals between 3.4028235E38 and 3.4028235E38. Certainly the Atmel Atmega328P microcontroller that Arduino is based on does not have support for floating point numbers and has an 8-bit limit in its architecture. However, they can be used because the compiler is capable of generating code sequences capable of doing the same function only using the simple computational units of the MCU.
There can also be other, more complex data types , such as arrays, pointers, strings, etc.
Table of Contents