New Tutorial - Intro to Data Types in Arduino


Today we wanted to point your attention to a new tutorial - Introduction to Data Types in the Arduino. To borrow a paragraph straight from the tutorial: The Arduino environment is really just C++, with library support and built-in assumptions about the target environment to simplify the coding process. C++ defines a number of different data types; in this tutorial, we talk only about those used in Arduino-land with an emphasis on traps awaiting the unwary Arduino programmer.

Basically, Arduino programmers might deal with any of the following types of data: boolean, byte, char, unsigned char, word, unsigned int, int, unsigned long, long, float. This tutorial will help you understand how to manipulate these types of data.

So check out the full tutorial! We hope it helps you understand better the types of data you might encounter working with Arduino and how to handle them. Enjoy!


Comments 14 comments

  • this is NOT how you define types in C++, this is how you do it in C. in C++ it would be “typedef int test_type;”

    • That’s also how I do in in C. I don’t know why you would use ‘#define’s for that kind of thing.

    • Which is why the Arduino programing environment is best described as being C\C++, the IDE can parse both C and C++.

  • Thanks for this. After taking Sparkfun’s brilliant Intro to Arduino class, (huge thanks to Dave, Theo, and Tim), I’ve convinced the theatre at which I work that they needed to purchase some Arduinos so that I could add more automation to their sets. So the more tuts the better!

  • Would be great to see the promised follow-up article soon ;-)

    • We are working on porting all of our tutorials over to our Learn site, which does have some more in-depth articles on some of the data mentioned in here. Try checking those out, but if there’s something specific we are missing, let us know!

      • I couldn’t quite find anything resembling this, but I guess that’ll arrive later…

        • Yea, unfortunately the porting over process is requiring a lot of tutorials be rewritten and updated, so it is taking a while as we are also actively working on creating new tutorials as well.

  • I’ve not used arduino, but its generally best practice to define types as signed or unsigned.

  • “Check the compile size: 2458 bytes for int versus 2488 bytes for byte. Not a lot bigger, but it IS bigger.” – No, it’s not: 2458


This Week

This Month

Heartbleed

Happy Arduino Day!