-
Book Overview & Buying
-
Table Of Contents
C Programming for Arduino
By :
Qualifiers are the keywords that are used to change the processor's behavior considering the qualified variable. In reality, the compiler will use these qualifiers to change characteristics of the considered variables in the binary firmware produced. We are going to learn about three qualifiers: static, volatile, and const.
When you use the static qualifier for a variable inside a function, this makes the variable persistent between two calls of the function. Declaring a variable inside a function makes the variable, implicitly, local to the function as we just learned. It means only the function can know and use the variable. For instance:
int myGlobalVariable;
void setup(){
}
void loop(){
myFunction(digitalPinValue);
}
void myFunction(argument){
int aLocalVariable;
aLocalVariable = aLocalVariable + argument;
// playing with aLocalVariable
}This variable is seen in the myFunction function only. But what happens after the first loop? The...
Change the font size
Change margin width
Change background colour