diff options
author | Perry Hung <iperry@gmail.com> | 2011-01-24 23:23:29 -0500 |
---|---|---|
committer | Perry Hung <iperry@gmail.com> | 2011-01-24 23:23:29 -0500 |
commit | c48689d34809943a5907884bd287cea9ae275352 (patch) | |
tree | d49ff06b0d4b81f6ab0eac8060d178ce7542476c /docs/source/arduino/define.rst | |
parent | 64431fd4b59cb8656365f1fad5f679cd4d756239 (diff) | |
parent | a9b2d70bc7799ca96c1673b18fe3012b1a4dd329 (diff) | |
download | librambutan-c48689d34809943a5907884bd287cea9ae275352.tar.gz librambutan-c48689d34809943a5907884bd287cea9ae275352.zip |
Merge remote branch 'leaf/master'
Diffstat (limited to 'docs/source/arduino/define.rst')
-rw-r--r-- | docs/source/arduino/define.rst | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/docs/source/arduino/define.rst b/docs/source/arduino/define.rst deleted file mode 100644 index 6190cb9..0000000 --- a/docs/source/arduino/define.rst +++ /dev/null @@ -1,83 +0,0 @@ -.. _arduino-define: - -Define -====== - -``#define`` is a useful C component that allows the programmer 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. - - - -This can have some unwanted side effects though, if for example, a -constant name that had been #defined is included in some other -constant or variable name. In that case the text would be replaced -by the #defined number (or text). - - - -In general, the *`const <http://arduino.cc/en/Reference/Const>`_* -keyword is preferred for defining constants and should be used -instead of #define. - - - -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. - - - -:: - - #define ledPin 3; // this is an error - - - -Similarly, including an equal sign after the #define statement will -also generate a cryptic compiler error further down the page. - - - -:: - - #define ledPin = 3 // this is also an error - - - -See ---- - - -- `const <http://arduino.cc/en/Reference/Const>`_ -- `Constants <http://arduino.cc/en/Reference/IntegerConstants>`_ - |