Where reflectPin is the the pin the sensor is connected to, and reflectVal is the value variable.
Normally, I would use senseReflection(reflectPin); but I can replace reflectPin with any value. Is there any way I can have a default value, such that if I were to use senseReflection(); it would interpret it as senseReflection(reflectPin); but still allow me to do use a different paramater, such as senseReflection(A2); ?
So basically you add an "= reflectPin" after pinVal.
However, default values does bring you into the area of a small bug in the IDE: You'll need to define the function prototype yourself. To do that, just copy and paste the function before the opening brace (so, in your case "int senseReflection(int pinval)") and add a semicolon before it. Put the prototype at the beginning of your sketch.
That and when I want defaults like say one could be
beginserial(int baudrate){
Serial.begin(baudrate);
}
//or
beginserial(int baudrate, int port){
If(port==1) serial1.begin(baudrate);
//etc port = n, begins serial n
}