arduino motorcycle

thanks for posting the code. It's fun to see someone else's work. A couple of things:

  1. Your code and your math look great(except for the bottom part of the gear indicator stuff -maybe you got tired of coding?). The worst I would say is that at low wheel speeds you'll be a slow to notice a gear change and you'll get some bad readings across gear changes - maybe you don't care.
  2. You should declare your z's, f's, and r's as volatile and you should turn off interrupts while you read and reset them. It's as simple as:
{noInterrupts();ratio = (z1*10) / r1;z1 = 0; r1 = 0; interrupts();}

If you don't do this, sooner or later you'll get bad data. It doesn't matter much to the gear indicator but for fuel injection and traction control....

Have you tried it on the bike? Are you still seeing spiky electrical pulses?