×

SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.

New Tutorial - Intro to Data Types in Arduino

Check out this new tutorial about all the types of data you might deal with while using Arduino.

Favorited Favorite 0

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

  • Gravis / about 12 years ago / 3

    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;"

    • baobrien / about 12 years ago / 1

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

    • Far_Seeker / about 12 years ago / 1

      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!

  • jensa / about 11 years ago / 1

    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!

      • jensa / about 11 years ago / 1

        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.

  • Member #193270 / about 12 years ago / 1

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

  • wpmcnamara / about 12 years ago * / 1

    "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

    • wpmcnamara / about 12 years ago / 1

      It won't let me input more than a line of text... sigh. Swap either the sizes or the types.

Related Posts

Recent Posts

Halloween Hacking

SparkFun Spooktacular

Tags


All Tags