aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api/setup.rst
blob: 837ddd6d0466294b9343e76d5860acdaf709c4b1 (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
.. highlight:: cpp

.. _lang-setup:

setup()
=======

The ``setup()`` function is called when a sketch starts. Use it to
initialize :ref:`variables <lang-variables>`, :ref:`pin modes
<lang-pinmode>`, start using :ref:`libraries <libraries>`, etc. The
``setup()`` function will only run once, after each power-up or reset
of the Maple board.

Example
-------

::

    int buttonPin = 38;

    void setup() {
      pinMode(buttonPin, INPUT);
    }

    void loop() {
      // ...
    }

.. include:: cc-attribution.txt