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.