Programming: Data types

Arduino IDE, data types, programming

When learning a new programming language, like the arduino, you can always see that there are different type of data to declare the variables and constants that can be handled during the program. These types of data vary in length and type depending on the language or platform (architecture) for which you are programming, although in many cases they are similar.

In this tutorial You will be able to learn what this type of data is, how many there are, why they differ, etc. This way, when you write source code, you will have a better understanding of what you are doing.

What are data types?

In computing, type of data They are attributes that indicate about the data class (unsigned integer, signed number, floating point, alphanumeric strings, matrices, ...) that is being handled. This also implies certain limitations or restrictions with the data, since they must respect a series of forms and format. They cannot take any value, nor can they trade them in any way.

If we get in the Arduino caseThis development board is nothing more than a small embedded computer, with an MCU or microcontroller composed of a memory, a CPU for processing, and an I / O system. In the CPU there is a series of calculation units, such as the ALU or arithmetic-logical unit, which does not care what type of data it is, for it it is simply a matter of doing operations with zeros and ones, but on the side The software does matter, since for the user or the programmer it is necessary to know what it is about (even for the proper functioning of the program, to avoid overflows, vulnerabilities, etc.).

Data types in Arduino IDE

Arduino UNO millis functions

If you already downloaded our free Arduino programming course, or if you already have programming knowledge on this platform or on any other, you will already know that there are several types of data. Specifically, the programming language used by Arduino is based on C ++, so in that sense it is very similar. For example, the most common 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 may also be other types of data more complex, such as arrays, pointers, text strings, etc.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.