## Reference.UnsignedInt History

September 14, 2012, at 11:29 PM by Scott Fitzgerald -
Changed lines 5-7 from:

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).

to:

On the Uno and other ATMEGA based boards, 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 Due stores a 4 byte (32-bit) value, ranging from 0 to 4,294,967,295 (2^32 - 1).

June 25, 2009, at 01:03 PM by Paul Badger -
Changed lines 37-38 from:
to:
May 06, 2008, at 06:51 AM by David A. Mellis -
Changed lines 12-13 from:
```    int ledPin = 13;
```
to:
```    unsigned int ledPin = 13;
```
Changed lines 16-18 from:
```    int var = val;
```

• var - your int variable name
to:
```     unsigned int var = val;
```

• var - your unsigned int variable name
May 27, 2007, at 03:51 AM by Paul Badger -
Changed lines 8-9 from:

The difference 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.

to:

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.

May 18, 2007, at 05:41 AM by Paul Badger -
Changed lines 8-9 from:

The difference 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.

to:

The difference 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.

May 18, 2007, at 05:39 AM by Paul Badger -
Changed lines 8-9 from:

The difference lies in the way the highest bit, sometimes refered to as the "sign" bit is interpreted. In the Arduino int type, 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.

to:

The difference 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.

April 25, 2007, at 12:52 AM by Paul Badger -
April 17, 2007, at 12:09 AM by David A. Mellis - not sure that unsigned int x = 65536; does what you expect (constant are signed ints, I believe)
Deleted lines 28-29:
```   x = 65535;
```
April 17, 2007, at 12:08 AM by David A. Mellis -
Changed lines 14-15 from:

to:

#### Syntax

Changed lines 34-36 from:

to:

April 16, 2007, at 09:23 PM by Paul Badger -

When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacitiy, note that this happens in both directions

April 16, 2007, at 06:35 PM by Paul Badger -
Changed lines 24-28 from:

[@unsigned int x x = 0; x = x - 1; // x now contains 65535 - rolls over x = 65535; x = x + 1; // x now contains 0

to:

[@ unsigned int x

```   x = 0;
x = x - 1;       // x now contains 65535 - rolls over in neg direction
```

```   x = 65535;
x = x + 1;       // x now contains 0 - rolls over
```
April 16, 2007, at 06:33 PM by Paul Badger -
Changed lines 29-33 from:

to:

@]

April 16, 2007, at 06:32 PM by Paul Badger -

## 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 lies in the way the highest bit, sometimes refered to as the "sign" bit is interpreted. In the Arduino int type, 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.

#### Example

```    int ledPin = 13;
```

#### Parameters

```    int var = val;
```

• var - your int variable name
• val - the value you assign to that variable

#### Coding Tip

[@unsigned int x x = 0; x = x - 1; // x now contains 65535 - rolls over x = 65535; x = x + 1; // x now contains 0