开发者

automatic gear shift

I was thinking about writing a program to automatically change the gear of my bike. It may require a microprocessor, so the question which I had in my mind was: is there any different language for programming a microprocessor or can this be done using c and c++?

开发者_运维百科

Another thing is, regarding the program, can a switch statement do my work or do I need a pointer or linked list because the gear works both ways, up and down?


C is a fine language for working with microprocessors and for many tasks writing in assembly is still viable.

I don't think you really need a complicated data structure.

I'd just define a few constants like the min and max gear and wheel diameter

Then have an array indexed using the gear number which has the min and max speeds for each gear and finally a variable to store the current gear.

I'd just trigger an interrupt every revloution and use that to calculate speed and issue the gear up and down command as necessary.

For extra use I'd put in something to say that you don't want to change gear if you're stationary, changed gear less than x ms ago and you'll need some sort of calibration.

Shimano have a system which looks good and reviews well but is expensive, still it would be good to use as a reference.


So i think you may be underestimating the simplicity of this task.

Is your bike already automatic? or will you be constructing a mechanical actuator to do the shifting?

also what kind of bike? bicycle? motorbike?

and for the data structure question, i would just use a simple array or a variable which holds the current gear number.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜