Arduino - Setup

Arduino

Guide

Tutorials

Reference

Hardware

Software

Forum

Playground

Exhibition

Hacking

FAQ

Buy

Language | Libraries | Comparison

## setup()

The setup() function is called when your program starts. Use it to initialize your variables, pin modes, start using libraries, etc.

### Example

    int buttonPin = 3;

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

    void loop()
    {
      if (digitalRead(buttonPin) == HIGH)
        serialWrite('H');
      else
        serialWrite('L');

      delay(1000);
    }

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

Edit Page | Page History | Printable View | Recent Site Changes