Setup()

From Microduino Wiki
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语法手册]