aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/arduino/setup.rst
blob: 79c952780e415a81f773e8c9a4d545dd10985396 (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
.. _arduino-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