Hi, I have this function which increases a variable when a analog value is given to it. Eg, low analog value would increase/decrease the value a little over time and a higher analogvalue would then increase the value a lot over time.
But here is the questions.
How should I go about expanding this library?
Make it work with floats, longs doubles, what ever input type you want.
Make it a pointer based and a return based. Eg, call the update function and it updates the pointer given to it.
like this
int valueToBeUpdated = 0;
void functionThatWouldUpdateValue();
I think you would have to pass the &memory location in the intilization part and & or pointer which the update function would get the analog value from.
Have a function that would mass update all of the objects.
I would like to have a function that I can pass function pointers to and that function would then call the update with a single line.
Have some optional arguments like deadzone and max/min value. I know how to implement theese but not elegantly.
if(inputvalue < deadzone || deadzone < inputvalue){
and to return the max I could just use a ternary.
return (input < max) ? input : max;
But not sure how to have this with pointer.
}
seems like you're talking about several different things
i think you're describing a class, not necessarily a library
i don't see the update() identified in the .h, wouldn't it be the function used to update the value and shouldn't it be public and shouldn't it return the updated value
don't see inputArray[] nor understand why you would need such
not sure what you mean by value type -- the value provided to the class or the value maintained and returned. (why not just do everything with doubles)
don't understand low, high and changeby. seems you would have a threshold above which you adjust the value by a large amount and below which you adjust by a small amount. are low/high the adjustment values or thresholds
don't understand the purpose of a deadzone. is the deadzone around the threshold
additional parameter (i.e. max, min can always be set in the constructor but need to be defined
are there just 5 parameters: min, deltaLow, thresh, deltaHigh, max?