Using millis() to measure elapsed time of a car turn signal

So, I have been scratching my head for a little while. I figured out part of the code (I think; being new to Arduino - and also not yet having access to the turn signal tap or even the USB data cable to upload - I don’t know if what I have so far would work.)
Basically, I need to make a program to calculate the average elapsed time between the beginning of the current turn signal pulse through when it is not lit up to the beginning of the next one, and so on.

I can’t seem to figure out the order (or even the logistics and syntax) in which to tell the board to measure.

What I have so far:

 #include <LiquidCrystal.h>

//Reading Variables
int inputPin = A0;

const int numberOfReadings = 10;

int readings[numberOfReadings];
int total = 0;
int average = 0;

/*  connect LCD with 
 *  RS on D12
 *  enable on D11
 *  D4 on D5
 *  D5 on D4
 *  D6 on D3
 *  D7 on D2
 *  RW to ground
 *  VSS to ground
 *  VCC on 5V
 *  220 resitor between backlight+ and 5V
 *  wiper to V0 
`*/
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
unsigned long start, finish, difference;

void setup() 
{
// put your setup code here, to run once
lcd.begin(16,2);
lcd.print("Hello World");
delay(2000);
for (int thisReading = 0; thisReading < numberOfReadings; thisReading++)
  {
  readings[thisReading] = 0;
  }
}

void loop() 
{
  int lastInput;
// put your main code here, to run repeatedly
//calculate time between pulses
for (int currentInput = 0; currentInput <numberOfReadings; currentInput++)
{
  difference = finish - start;
  total = total - readings[currentInput];
  total = total + readings[lastInput];
  if (inputPin = HIGH)
  {
    start = millis();
    start = start/1000;
  }
  else if (inputPin = LOW)
  {
    finish = millis();
    finish = finish/1000;
    readings[currentInput] = difference;
    
    lcd.print("recent:"+ readings[currentInput]);
  }
  else
  {
    // calculate the average
    average = total / numberOfReadings;
  }
  lastInput = readings[currentInput];
}

// send average to the LCD
lcd.setCursor(0,0);
lcd.print(average);

}

So far, this measures the time between pulse1 on and pulse1 off, but not between pulse1 off and pulse2 on. Is there a way I can measure it all at once, or should I make two loops that I can add a returned value from?

for (int thisReading = 0; thisReading < numberOfReadings; thisReading++)
  {
  readings[thisReading] = 0;
  }

They’re already zero.

if (inputPin = HIGH)Oops.

The compiler has already done that for you

for (int thisReading = 0; thisReading < numberOfReadings; thisReading++)
  {
  readings[thisReading] = 0;
  }

as readings is a global variable.

In this code

//Reading Variables
int inputPin = A0;

....

  if (inputPin = HIGH)
  {
    start = millis();
    start = start/1000;
  }
  else if (inputPin = LOW)
  {

how do you want a pin Number to be HIGH or LOW… a pin number is a pin number… it won’t change…

You problem is you not only don’t read the value but also your arduino is fast, so it will read many many times the HIGH and you’ll keep changing your start time. You need to look for transitions from LOW to HIGH or HIGH to LOW.

EDIT - AWOL was faster as always :)

(Actually, that “Oops2”)

So, without knowing how long to initially delay between each transition, how should I go about making each measure (array entry) a process: 'start'/w HIGH -> LOW -> 'finish'@ HIGH?

And also what exactly do you mean by oops? Sorry if it might be an obvious answer, but I'm fairly n00bish when it comes to programming and more specifically Arduino...

Oops that you did an assignment, not a comparison, oops again because you didn't actually read the pin.

The IDE has a state change example.

OHHH Whoops I did not see those.. How stupid of me. As for reading the pin, I shall read some more and try to fix this. Thank you though