aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/setup.rst
blob: 6b142d243f9abcb800ef057b75fb0cbfb56d49ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.. _lang-setup:

setup()
=======

The setup() function is called when a sketch 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 Arduino board.



Example
~~~~~~~

::


    int buttonPin = 3;

    void setup()
    {
      Serial.begin(9600);
      pinMode(buttonPin, INPUT);
    }

    void loop()
    {
      // ...
    }



.. include:: cc-attribution.txt