Arduino - Define

Arduino

Guide

Tutorials

Reference

Hardware

Software

Forum

Playground

Exhibition

Hacking

FAQ

Buy

Language | Libraries | Comparison

## Define

`#define` is a useful C component that allows you to give a name to a constant value before the program is compiled. Defined constants in arduino don't take up any program memory space on the chip. The compiler will replace references to these constants with the defined value at compile time.

Arduino defines have the same syntax as C defines:

#### Syntax

`#define constantName value`

Note that the # is necessary.

#### Example

    #define ledPin 3
    //The compiler will replace any mention of ledPin with the value 3 at compile time.

#### Tip

There is no semicolon after the #define statement. If you include one, the compiler will throw cryptic errors further down the page.

#### See

- Constants

Reference Home

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

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