diff options
author | Perry Hung <iperry@gmail.com> | 2011-01-24 23:23:29 -0500 |
---|---|---|
committer | Perry Hung <iperry@gmail.com> | 2011-01-24 23:23:29 -0500 |
commit | c48689d34809943a5907884bd287cea9ae275352 (patch) | |
tree | d49ff06b0d4b81f6ab0eac8060d178ce7542476c /docs/source/arduino/unsignedint.rst | |
parent | 64431fd4b59cb8656365f1fad5f679cd4d756239 (diff) | |
parent | a9b2d70bc7799ca96c1673b18fe3012b1a4dd329 (diff) | |
download | librambutan-c48689d34809943a5907884bd287cea9ae275352.tar.gz librambutan-c48689d34809943a5907884bd287cea9ae275352.zip |
Merge remote branch 'leaf/master'
Diffstat (limited to 'docs/source/arduino/unsignedint.rst')
-rw-r--r-- | docs/source/arduino/unsignedint.rst | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/docs/source/arduino/unsignedint.rst b/docs/source/arduino/unsignedint.rst deleted file mode 100644 index 10835fe..0000000 --- a/docs/source/arduino/unsignedint.rst +++ /dev/null @@ -1,77 +0,0 @@ -.. _arduino-unsignedint: - -unsigned int -============ - -Description ------------ - -Unsigned ints (unsigned integers) are the same as ints in that they -store a 2 byte value. Instead of storing negative numbers however -they only store positive values, yielding a useful range of 0 to -65,535 (2^16) - 1). - - - -The difference between unsigned ints and (signed) ints, lies in the -way the highest bit, sometimes refered to as the "sign" bit, is -interpreted. In the Arduino int type (which is signed), if the high -bit is a "1", the number is interpreted as a negative number, and -the other 15 bits are interpreted with -`2's complement math. <http://en.wikipedia.org/wiki/2's_complement>`_ - - - -Example -------- - -:: - - unsigned int ledPin = 13; - - - -Syntax ------- - -:: - - unsigned int var = val; - - - - -- var - your unsigned int variable name -- val - the value you assign to that variable - - - -Coding Tip ----------- - -When variables are made to exceed their maximum capacity they "roll -over" back to their minimum capacitiy, note that this happens in -both directions - - - -:: - - unsigned int x - x = 0; - x = x - 1; // x now contains 65535 - rolls over in neg direction - x = x + 1; // x now contains 0 - rolls over - - - -See Also --------- - - -- `byte <http://arduino.cc/en/Reference/Byte>`_ -- `int <http://arduino.cc/en/Reference/Int>`_ -- `long <http://arduino.cc/en/Reference/Long>`_ -- `unsigned long <http://arduino.cc/en/Reference/UnsignedLong>`_ -- `Variable Declaration <http://arduino.cc/en/Reference/VariableDeclaration>`_ - - |