用户工具

站点工具


en:reference:language:setup

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
reference:language:setup [2014/11/07 12:18] 弘毅en:reference:language:setup [2023/06/07 04:23] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
 +===== setup() =====
 +
 +The setup() function is called when program starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the ocrobot board.
 +
 +====Example====
 +
 +<code cpp> 
 +int buttonPin = 3;
 +
 +void setup()
 +{
 +  Serial.begin(9600);
 +  pinMode(buttonPin, INPUT);
 +}
 +
 +void loop()
 +{
 +  // ...
 +}
 +</code>