Unsigned long

From Microduino Wiki
Revision as of 07:53, 18 August 2016 by Fengfeng (talk) (Created page with "unsigned long int<br> *'''Description'''<br> Unsigned long int extends the capacity of the variable so that it can store lager data, which can store 32-bit(4 bytes) data. Dif...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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]