Data Types in Arduino  What are they? + List ▷ 2020

If you like electronics and programming surely you are interested in knowing all the necessary details about the handling and operation of Arduino, which is a board based on a free hardware and software microcontroller. This board has an integrated circuit by which instructions can be recorded.

It is worth mentioning that all these instructions are written on this platform through a data programming language that allows the user to establish programs that interact with said electronic circuits. Keep in mind that Arduino consists of a board that has all the necessary elements to connect input / output pins of a microcontroller.

It is important that when working on this platform you can know all the necessary details about your schedule, this is how here we are going to show you the different types of data that are handled in ArduinoTo do this, follow in detail everything that we will teach you next in the post.

What is data in Arduino programming and what is it for?

When wanting to write a program with Arduino, it is necessary to take into account several types of basic elements in its structure, such as the following:

  • Processing directives: They are in charge of controlling the conversion of the program to machine code by the compiler.
  • Programs or functions: It is a set of instructions, there may be one or more, but in any case there must always be one defined as the main one by including the void loop call.
  • Instructions: They indicate how the Arduinos should behave at all times.
  • Comments: They allow you to write what each line of the program means.

Bearing this in mind it is important to keep in mind what they are the data types in Arduino, in this case the arduinos tend to be highly data independent, since in their cores there is the logical arithmetic unit named as ALU, and it is in charge of executing simple operations in its memory. In this case a the logical arithmetic unit you don’t really care that it renders the data types to the user, either text, integer or float values ​​or even the programming code.

Keep in mind that all the context for the operations comes from the compiler and the user, who is the one who ends up defining the values ​​and indicates the instructions to the compiler. In programming terms the computer data types or type is an attribute of the data that they tell the computer about the kind of data to be worked on. In this way you can impose restrictions on data, like the values ​​that can be taken and what operations can be performed.

List of all data types used in Arduino project programming

List of all data types used in Arduino project programming

Currently the most common data used in Arduino are integers, floating point number, negative signed number, states (Boolean), and alphanumeric strings.

With this in mind, here we are going to show you some of the most used data in C ++ so that you can keep them in mind:

Byte

It is responsible for storing a 8-bit numeric value without decimals, it offers a range that goes between 0 and 255 without sign.

Int (integer)

They are considered as a type of primary data that are responsible for storing 16-bit numeric values ​​are decimal in the range 32,767 to -32,768. In the case of variables of type integer (int) they can exceed its maximum or minimum value as a result of an operation.

Long (long integer)

The extended type numeric variable format “Long” refers to type integers 32 bits = 4 bytes, without decimals that are within the range -2147483648 to 2147483647.

Float (decimals)

This is a data format of the type “Floating point” or “Float” as it is also known, it applies to numbers with decimals. Floating point numbers have a higher resolution than floating point numbers. 32 bit that it occupies with a range between 3.4028235E + 38 to -3.4028235E + 38.

In the case of floating point numbers they are not exact numbers, they can produce strange results in comparisons. In this case the floating point mathematical calculations are also much slower than those of the integer type, so their use should be avoided if possible. In the case of Arduino of data type double is equal to float.

In this case the floating point constants are used to make the code easier to read, even if they are not used, the compiler will not give an error and will run normally:

  • 0 is evaluated as 10.
  • 34E5 or 67e-12

So that all this can be understood in a better way, the floating point representation is a form of scientific notation that is used in GPU, FPU, CPU, among others and with which extremely large and small rational numbers can be represented in a very compact and efficient way, with which it is possible to carry out arithmetic operations. Regarding the standard for floating point representations is IEE 754.

Char (character)

A char represents a character which occupies 1 byte of memory, in this case the simple characters are represented with single quotes and for multiple characters or strings they are presented with double quotes. It is important to remember that characters are stored as numbers using ASCII encoding, which means that it is possible to do arithmetic operations with the characters.

Boolean

In the case of Boolean data they only have two true and false values, each boolena it is characterized by occupying one byte of memory.

Data types in visualino

In visualino you can refer to data types in both local and global variables and you have the following data:

  • Int,
  • Bytes.
  • Long.
  • String.
  • Float.

Type conversions (Casting)

Finally we find the casting, which allows forcing the change of data and for this the following can be used:

  • Char.
  • Int.
  • Long.
  • Float.
  • Byte.
  • word.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thank you! 😉

You may be interested:

Leave a Comment