Last active
October 6, 2016 15:10
-
-
Save nadavmatalon/4a51b6075592a7675021f8aae99212da to your computer and use it in GitHub Desktop.
Arduino: Assigning Default Parameter Value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void test(int val1, int val2=2); | |
void setup() { | |
Serial.begin(9600); | |
test(10,11); | |
test(12); | |
} | |
void loop() {} | |
void test(int val1, int val2) { | |
Serial.print(F("\nVal1: ")); | |
Serial.print(val1); | |
Serial.print(F("\n")); | |
Serial.print(F("\nVal2: ")); | |
Serial.print(val2); | |
Serial.print(F("\n\n---------------\n\n")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When working with multiple files:
*.h
void test(int val1, int val2=2);
*.cpp