Help with interrupts

So I'm trying to do a speed trap for a motorcycle track. I got two sharp ir sensors and thought it would be easy using the attachInterrupt. The triggers would keep the time and then it would be a simple calculation to get the speed.

What's happening is that the second trigger keeps firing so the second wheel of the motorcycle is triggering it again :frowning:

Here is a copy of the code (which I am sure is wrong). If anyone can help, I would greatly appreciate.

int Delay = 2000;
int led = 13;
int led2 = 7;
int ledReady = 9;
int FirstInterval = 0;
int SecondInterval = 0;
//volatile int state = LOW;

float Distance = 0.00030;//Distance In Kilometers 30cm
float KMperHour = 0;

void setup()
{
// Serial.begin(9600);
// analogWrite(led,255);
// analogWrite(led2,255);
// analogWrite(ledReady,255);
pinMode(2, INPUT);
pinMode(3, INPUT);
attachInterrupt(0, first, RISING);
attachInterrupt(1, second, RISING);
lcd.begin(16, 2);
lcd.print(" ABC Speed Trap ");
lcd.setCursor(0, 1);
lcd.print(" Welcome :)");
}

void loop()
{
CalculateSpeed()
}

void first()
{
FirstInterval = micros();
}

void second()
{
SecondInterval = micros();
}

void CalculateSpeed()
{
KMperHour = 0 ;

float timeDifference = SecondInterval - FirstInterval ; //in MilliSeconds

timeDifference = timeDifference /3600000 ; //in Hours

KMperHour = Distance / timeDifference ;
if (KMperHour < 0)
{
KMperHour = KMperHour *-1;
}
}

void loop()
{
  while(SecondInterval==0) ;
  noInterrupts(); 
  CalculateSpeed();
  SecondInterval=0
  Interrupts();
}

integer datatypes truncate during division
micros() returns unsigned long, so the vars that use times should be unsigned long
interrupt vars should be volatile

a partial rewrite of your code using only one sensor. It need some work to compile but you should get the essence

volatile unsigned long time1 = 0;
volatile unsigned long time2 = 0;

float Distance = 0.00030;//Distance In Kilometers 30cm
float KMperHour = 0;

void setup()
{
  pinMode(2, INPUT);
  attachInterrupt(0, first, RISING);

  lcd.begin(16, 2);
  lcd.print(" ABC Speed Trap ");
  lcd.setCursor(0, 1);
  lcd.print("   Welcome smiley");
}

void loop()
{
  CalculateSpeed()
  lcd.setCursor(0, 1);
  lcd.print(KMperHour);
  delay(1000);
}

void first()
{
  time1 = time2;
  time2 = millis();
}

void CalculateSpeed()
{
  cli();  // disable interrupts when copying values
  unsigned long duration = time2 - time1; 
  sei();

  float hours = duration/3600000.0  ; //from millis() to Hours
  KMperHour = Distance / hours;
}