aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/arduino/setup.rst
blob: 05911ed71c10e2a98bfbad06c04f5b27b99035af (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
.. _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()
    {
      // ...
    }