Unsigned long

From Microduino Wiki
Jump to: navigation, search

unsigned long int

  • Description

Unsigned long int extends the capacity of the variable so that it can store lager data, which can store 32-bit(4 bytes) data. Different from standard long int, unsigned long int can’t store negatives, and the range is from 0 to 4,294,967,295(2 ^ 32 - 1).

  • Example
unsigned long time;
 
void setup()
{
     Serial.begin(9600);
}
 
void loop()
{
  Serial.print("Time: ");
  time = millis();
//The program is printing time all the time since starting.
  Serial.println(time);
//Wait a second, in order to avoid sending large amount of data. 
     delay(1000);
}
  • Syntax
unsigned long var = val;

var - The name of the variable that you will define
val - The value to be assigned to the variable

[Return to Arduino Syntax Manual]