I am very new to coding and I am attempting to teach myself the best I can. I have no prior knowledge of coding and am filling in the blanks via YouTube and forums alike. One place I keep getting hung up on is what seems to be an unsigned integer.

I have tried to figure out how these work (assignment and such) to no avail. I was wondering if anyone could offer some insight for me or at the least a link that gets specific for the Arduino.

I see them used as uint8_t, uint16_t, and uint_32 in various places. Am I correct that it is an unsigned integer? Meaning it is a whole positive number only.

The code I have attached is from Adafruit's article on multi-tasking. I am trying to adapt my sketch for millis() over delay().

      uint32_t Color1, Color2;  // What colors are in use
      uint16_t TotalSteps;  // total number of steps in the pattern
      uint16_t Index;  // current step within the pattern

For instance: on the variable declarations they use these for the color. I will need to change the colors, but have only seen them expressed in RGB. They are in every sketch I see, but I am struggling to answer this question on my own. Thanks in advance for any help.

2 Answers 2


If you search for information about C types on the internet, there will be much help to find, but effectively you are correct. One format of integer types in C take the form:

uint / int: Signed or unsigned integer. Unsigned integers are stored in simple binary representation, and signed integers are stored in two's complement form.

8 / 16 / 32 / 64: The number of bits to store the value. This means the number of possible values is 2x where x is the number of bits.

_t: Simply a suffix to indicate that it is a type name, not a variable.

Colour storage

Colours are generally stored as three components: red, green and blue (or sometimes four, adding alpha, the degree of transparency).

If each component is given an unsigned byte to be stored (so it has a value from 0–255), then the total colour size is 24 bits. However, 24 bit integers are not a standard size, so the next bigger size is selected, 32-bit. This also allows room for an alpha component if necessary, but otherwise the spare 8 bits are unused.

For example:

| 00000000 | 00000000 | 00000000 | 00000000  | = 32 bits
| red      | green    | blue     |alpha/empty|
  • Thank you so much for this. The breakdown helps to simplify it for me.
    – Gixxerfool
    Jan 2, 2016 at 14:30

Everything about standard integer types is in <stdint.h>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.