Data Types in Arduino

Pages
Contributors: b_e_n
Favorited Favorite 38

Resources and Going Further

I'm going to leave it here for now. I hope I've demonstrated clearly the benefits of using appropriate data types for your variables. The next tutorial will go into some of the really ugly pitfalls that are hiding in mixing data types and using INAPPROPRIATE data types - for instance, data types that are too small for the largest number that you may encounter.

All of the context for these operations comes from the compiler, and the directions for the context get to the compiler from the user. You, the programmer, tell the compiler that THIS value is an integer and THAT value is a floating point number. The compiler, then, is left trying to figure out what I mean when I say "add this integer to that floating point". Sometimes that's easy, but sometimes it's not. And sometimes it SEEMS like it SHOULD be easy, but it turns out to yield results you might not anticipate.

Here's some further reading you may want to explore with your new knowledge of data types:

Interested in learning more foundational topics?

See our Engineering Essentials page for a full list of cornerstone topics surrounding electrical engineering.

Take me there!