Hello,

I have used one inductive sensor and placed my sensor on bike frame such that whenever the spokes of bike coincide with the sensor, it will generate the magnetic field surrounding the coil changes. So what I did is first determine the RPM value and then multiplied the RPM value with circumference of the wheel. The result would be in meters per minute. I am not getting right result. Please help. I think that my formula is not right?

```
volatile byte revolutions;
unsigned int rpmilli;
float speed;
unsigned long timeold;
void setup()
{
Serial.begin(9600);
attachInterrupt(0, rpm_fun, RISING);
revolutions = 0;
rpmilli = 0;
timeold = 0;
}
void loop()
{
if (revolutions >= 20) {
//Update RPM every 20 counts, increase this for better RPM resolution,
//decrease for faster update
// calculate the revolutions per milli(second)
**rpmilli = revolutions/(millis()-timeold)
timeold = millis();
* revolutions = 0;
// WHEELCIRC = 2 * PI * radius (in meters)
// speed = rpmilli * WHEELCIRC * "milliseconds per hour" / "meters per kilometer"
// simplify the equation to reduce the number of floating point operations
// speed = rpmilli * WHEELCIRC * 3600000 / 1000
// speed = rpmilli * WHEELCIRC * 3600
speed = rpmilli * WHEELCIRC * 3600;
Serial.print("RPM:");
Serial.print(rpmilli * 60000,DEC);
Serial.print(" Speed:");
Serial.print(speed,DEC);
Serial.println(" kph");
}
}
void rpm_fun()
{
revolutions++;
}
```