Hi All.
This is my first post here so be gentle. I had a friend write some code for me for a tacho I have designed. Although the board I have designed is not based on an Arduino he wrote it using Arduino IDE and includes. The tacho is based on an ATMEGA168/328 (which I believe are pin compatible). It has a few 7 seg displays for the tacho and also one for the gear indicator.
Due to work commitments and location changes this friend is no longer available to assist leaving me a very steep learning curve. I have never programmed in C or C++ before so that gives you an indication of the steepness of this curve, I think they call it vertical.
When I try to compile the code it comes up with an error, 'TACHO_LOW_PASS_RC' was not declared in this scope. Not sure what this means or how to fix it.
To get some of the wonderful help (Note the grovelling) from the people on here what details do you need me to supply? I have attached the code and a schematic. Let me know what else you need.
TIA
Jason
Tacho_R4.pdf (180 KB)
Tacho.ino (9.07 KB)
tacho.h (2.92 KB)
Surely someone is interested.
That's a good bit of code to figure out.
Explaining it to you so that you can finish it is not going to happen.
So someone interested would need to interested in doing that for you.
Maybe you should ask a moderator to move this to gigs and collaborations?
How far did your neighbor move that you can't get help over the net?
I've helped people in South Africa and Budapest from here in the US.....
Thanks for your reply. The friend moved about 100km away. He doesn't want to do anything else with it so I am on a steep learning curve.
Good idea about the mod moving it. I didn't think of that sort of thing.
It looks like he hit a problem that some of that code was trying to solve.
I don't know about that. He is just very busy with a new job and a new family.
Hey mods, can you move this to the gigs area or somewhere more appropriate.
Knock Knock. Any Mods awake out there?
I'm not convinced of the smoothing function where that constant is. Firstly, unless your holding back code ;), then that constant is not defined anywhere.
Secondly those scoped statics in that function aren't updated. I see what he's trying to do though, he's roughly carrying over a major portion of current revs with the left over portion of the previous revs to smooth it out.
But as prevMicros is not updated, and micros() is ever incrementing, its soon going to goto shit. The smoothing factor will dminish and you'll be back to erratic rpm.
To get you compiling (hopefully!), replace this line:
float alpha = dt / (TACHO_LOW_PASS_RC + dt);
with this one, shoudl give 10% smoothing between frames:
float alpha = dt / (dt * 1.1f);
Most of that was all over my head but at least it compiles now. I will test it over the weekend.
Thank you