unsigned long

描述

unsigned long (无号长整数) 是一个延伸储存空间的变数型别,可以储存 32bits (4 bytes) 大小的整数。不像 signed long (有号长整数),它不储存负数,所以储存范围从 0 到 4,294,967,295 (2^32 – 1)。

范例

unsigned long time;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.print("Time: ");
  time = millis();
  // 印出程式执行至目前为止所经过的时间
  Serial.println(time);
  // 等一秒,不要让它一下子输出大量的资料
  delay(1000);
}

语法


unsigned long var = val;

var unsigned long 型态的变数名称
val 指派给变数的值

See also

byte
int
unsigned int
long
Variable Declaration


语法参考主页面

本页由热血青年 LBU 译自英文版。

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.