aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api/setup.rst
blob: 1e8e3b8d59c5d990a826d114d959a03d861aa865 (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:: /arduino-cc-attribution.txt