Google+ Followers

Tuesday, August 28, 2012

Introduction to Data Types in Arduino Programming

Article: Introduction to data types in the Arduino

Computers, including the Arduino, tend to be highly data agnostic. At their core, the heart of the device is an arithmetic-logic unit, which performs (fairly) simple operations on locations in memory: R1+R2, R3*R7, R4&R5, etc. The ALU doesn’t care what that data represents to a user, be it text, integer values, floating point values, or even part of the program code. 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.

No comments:

Post a Comment