Setup()

From Microduino Wiki
Revision as of 03:46, 4 August 2016 by Fengfeng (talk) (Created page with "*'''setup()''' The setup() function is called once when your program in Arduino starts. It is used to initialize variables, set pin output\input mode, configure serial, intro...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • setup()

The setup() function is called once when your program in Arduino starts.

It is used to initialize variables, set pin output\input mode, configure serial, introduce the class library files and soon.

Every time Arduino is powered or restarted, setup function is run only once.

  • Example
int buttonPin = 3;
void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
}
void loop()
{
  // ...
}

[返回Arduino语法手册]