Setup

setup()

The setup() function is called when the sketch starts. It is used to initialize variables, determine the operating modes of the outputs, run the used libraries, etc. The setup function runs only once, after each power-up or reset of the Arduino board.

Example

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