Data Types Data TypeĪn array can be seen as a sequence in which data can be accessed through (index) numbers.Ī boolean can hold one of tow value: true or false The C language for Arduino Programming knows a number of “Data Types”, I’ll list them below, and do not worry too much if you’re not understanding some of these. A sequence of characters enclosed like this is called a “ string“, and a “string” is actually one of those “data types”. This is what in the language C (used for Arduino Programming) is the common way to indicate text. You might have noticed that I typed double quotes ( “ ) around the text pieces. That’s why there are in most programming languages so called “ data types” – which defines the type and how to handle a given kind of data.ĭata Types define how data can be handled and how it needs to be stored. These are of course very simplistic examples, but I think you will understand now why the computer needs to be told what kind of data it is dealing with. It needs to knows what kind of operations can be done, how these operations are to be done, and how to store the data. However if we store the number 34, then the computer would need only 1 byte! So if we want to store the text “34”, the computer would need at least 2 bytes. If the data is a number, things do change a little bit. So if we want to store text, then we would need at least one byte per character. If we think back about the explanation of “bit” and “byte” in the previous article, then we know that byte is 8 bits and that it can store a character. Since text can also contain numbers, our example becomes even more complicated for the computer. The same example with numbers 3 × 4 makes 12 and 3 + 4 makes 7 (but not “ 34“)! You can add two parts of text, making the result a text with both arts glued together, but when you add two numbers you do not necessarily get these 2 numbers in sequence.įor example “ abc” × “ def” makes no sense, however “ abc” + “ def” could make “ abcdef“. You cannot multiply two pieces of text, however, numbers you can multiply. To illustrate how these need to be handled differently is for example this Let’s take a look at two basic types of data, for example text and numbers. Why Data Types?ĭata however, comes in different forms and shapes, and can be handled in only a few ways. After all, that’s what computers do: handle data. Either to detect it, display it, respond to it, or mangle it in some kind of way. DataTypes: Data for our Arduino ProgrammingĮvery program, or at least most of them, work with data or information. Pointer Access Operators and Bitwise OperatorsĪ complete overview of this course can be found here: Course Overview. 1 DataTypes: Data for our Arduino Programming.
0 Comments
Leave a Reply. |