Timers

Hello

I am undertaking a project, which has two tubes (one glass and copper) in the vertical, where I have to pass it a magnet, and has 2 sensors in each tube one upstairs and one downstairs and I have to measure time between the sensor top and bottom sensor, but I am having difficulty in timers, and need help.

I hope that the explanation has not been confused

I leave here a part of the program I could do:

#include <Wire.h>
#include <LiquidCrystal.h>



LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


// define some values used by the panel and buttons
  int lcd_key     = 0;
  int adc_key_in  = 0;
  int sensor1 = 9;
  int sensor2 = 11;
  int sensor3 = 10;
  int sensor4 = 12;
  


void setup()
{
   pinMode(sensor1, INPUT);
   pinMode(sensor2, INPUT);
   pinMode(sensor3, INPUT);
   pinMode(sensor4, INPUT);
   lcd.begin(16, 2);              // start the library
   lcd.setCursor(0,0);
   lcd.print ("* Queda Graves *");
   lcd.setCursor(0,1);
   lcd.print (" V1.0      2014 ");
   delay (1500);
  }


void loop ()
{
  lcd.setCursor (0,0);
  lcd.print ("Tb1           ms");
  if (digitalRead(sensor1) == HIGH) {
    time1 millis();
  if (digitalRead(sensor2) == HIGH) {
    lcd.setCursor (5, 0);
    lcd.print (time1); //aqui deve estar colocado o tempo que demorou no tubo 1 
    }
  }
  

  lcd.setCursor (0, 1);
  lcd.print ("Tb2           ms");
  if (digitalRead(sensor3) == HIGH) {
    time2 millis();
  if (digitalRead(sensor4) == HIGH) {
    lcd.setCursor (5, 1);
    lcd.print (time2); //aqui deve estar colocado o tempo que demorou no tubo 2
    }
  }
  
}

I hope that the explanation has not been confused

I’m afraid that it was. A picture would be useful.

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


// define some values used by the panel and buttons
  int lcd_key     = 0;
  int adc_key_in  = 0;
  int sensor1 = 9;

It’s generally not a good to idea to try to use a pin (9) for multiple purposes.

Ola ! Que pasa ? Di me en espanol su problema .

Avlis: Hello

I am undertaking a project, which has two tubes (one glass and copper) in the vertical, where I have to pass it a magnet, and has 2 sensors in each tube one upstairs and one downstairs and I have to measure time between the sensor top and bottom sensor, but I am having difficulty in timers, and need help.

I hope that the explanation has not been confused

I leave here a part of the program I could do:

    time1 millis();What is that supposed to do?