Framework (A-Z)

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.



const int a = 10;

void setup()

void loop()
  Serial.println(a);  // outputs the value of a
  // uncommenting the following lines gives a copiler error
  // a = a + 1;  
Description The const qualifier is used to create read-only variable, const variables can not be assigned to. They must be initialized when declared. They are useful for the compiler to make optimizations when using it to declare pin numbers which are not likely to change in the code.
const datatype variablename = initialvalue
datatype any data type: int, double, long, char, byte etc
variablename a valid variable name
initialvalue a valid value for the type of variable
Usage Application
Updated on July 07, 2011 11:08:01pm PDT

Creative Commons License