Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
void setup(){
Serial.begin(9600);
}
void loop (){
a_function();
// Serial.print("In loop: ");
// Serial.println(local_variable); // local_variable is out of scope so compilation will produce an error message
delay(1000);
}
void a_function(){
static int local_variable = 0;
Serial.print("In a_function: ");
Serial.println(local_variable);
local_variable++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment