First of all let me apologise for my complete lack of coding knowledge. I touched on C+ back in my uni days but that was 12 years ago and I have had no need for it ever since!
I come here with the idea of creating a programmable 5 volt switch based on a variable 0-5 volt input signal.
The basis for this is to use the 5 volt switch feature of the Power Commander V (PCV) fuel controller for a motorcycle. This feature allows switching between two fuel tables inside the PCV depending on riding conditions (fuel economy vs power for example).
My idea is to take the 0-5 volt throttle position signal (TPS) and process it so that under certain conditions (like cruising at a steady speed for more than 30 seconds) a 5 volt signal can be sent to the PCV to switch between the 2 fuel maps.
The conditions to be met are as follows:
TPS rate of change less than X volts per millisecond (X to be user definable based on physical testing, estimated initial value based on 1/2 throttle turn in 1/2 second = 2.5 V / 500 ms = 0.005 V/ms)
TPS smoothness factor less than Y for 1 second (Y to be calculated by squaring the TPS rate of change to make all values positive then average over a period of 30 seconds)
Engine run time greater than 120 seconds.
The inspiration for this project comes from an interesting article over at http://www.autospeed.com/cms/A_113196/article.html
I thought about manually switching between a fuel economy map and a power map but the issue seems to be the adverse effect on driveability when targeting extreme fuel economy. A much better approach would be to switch automatically into the economy mode only when cruising along. This could of course be done manually but it would get annoying or forgotten about on smaller sections of cruising.
Thanks for reading!