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,相关说明请参考此连结


语法参考主页面

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

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.