创客百科

姿势共享,有节操无门槛参与的创客百科,创客动力之源 \ (^_^) /

用户工具

站点工具


arduino:language:setup

setup()

在Arduino中程序运行时将首先调用 setup() 函数。用于初始化变量、设置针脚的输出\输入类型、配置串口、引入类库文件等等。每次 Arduino 上电或重启后,setup 函数只运行一次。

示例

int buttonPin = 3;
 
void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
}
 
void loop()
{
  // ...
}
本页面的其他翻译:
arduino/language/setup.txt · 最后更改: 2016/12/25 22:15 (外部编辑)