Thank you all for your help and the advice on single letter parameters is great but im still not sure im understanding the examples posted.
So if i have 3 arguments for my function and i want to declare argument 1, 2, 3 or just argument 1 and 3 how would this be done.
So we have 3 arguments color, speed and say brightness.
my header file would have like so.
void Classname::Config(char color, char speed, int brightness);
now if i want to just set the color and brightness or speed and brightness it would no doubt return an error could someone show me any implementation of this or tell me if i am not making sense.
i have written a test function below:
code.h
#ifndef CP
#define CP
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class my_class{
public:
my_class();
void config(char arg1, char arg2, int arg3);
};
#endif
code.cpp
#include "code.h"
my_class::my_class(){
//Nothing.
}
my_class::config(char arg1, char arg2, int arg3){
if(arg1 != ''){
Serial.println(arg1);
}
if(arg2 != ''){
Serial.println(arg1);
}
if(arg3 != 0){
Serial.println(arg1);
}
}
code.ino
#include "code.h"
my_class my_class;
void setup(){
my_class.config('r', 's', 255); //Argument 1, 2 & 3 //
my_class.config('r', 's'); //Argument 1 & 2 // - all can be done by default value
my_class.config('r'); //Argument 1 //
my_class.config('s', 255); //Argument 2 & 3 Is this possible
my_class.config(255); //Argument 3, is this possible.
}
I may have some errors in the code i have just typed this in a comments box of memory so please excuse if you spot anything, hope this explains better.