setup( )

86Duino 板在開始執行 sketch 程式碼(註1)時會先呼叫 setup( ) 函式,利用它去初始化變數、pin 腳模式、啟動宣告的 libraries 等等…,這個函式在 86Duino 板通電或重置後只會執行一次。

範例

int buttonPin = 3;

void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
}

void loop()
{
  // ...
}

註1:Arduino/86Duino 將程式碼稱為 sketch,相關說明請參考此連結


語法參考主頁面

本頁由熱血青年 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.