time passed.

How do I take print times and move them into a place that they can be mathimatically altered and then put that value so it can be displayed on an LCD screen?

I have made a scquence to find the start and stop time, but I need to take the start away form the end to be able to see the time that has passed I want to know how I can take the start and stops times to be put in to a formula.

Any help much apreciated.

I have made a scquence to find the start and stop time

Tell us more about that code. Where are you getting the time values? What libraries, if any, are you using?

Generally, all time routines are based on a number of seconds elapsed since some event. Having access only to the formatted output means that you will need to re-create that number of seconds since some event.

Do that for both times, and the difference is the number of seconds between the times.

If you have access to the original time values (as number of seconds from some event), the process is much simpler.

So, we need to know how you are getting the times.

Ah OK here's my code so far

int startPin = 1;
int stopPin = 2;
void setup()
{
Serial.begin(9600);
}

void loop(){

pinMode(stopPin, INPUT);
pinMode(startPin, INPUT);
{
if (startPin, HIGH);
{
Serial.print("Time: "); //start time

if (stopPin, HIGH);
{
Serial.print("Time: "); //Stop time

Have a look a the millis() function, it returns the number of milliseconds that have elapsed since the arduino board was started.

OK. So, you have no idea how to get the time that events occur. That's what the millis function is about. millis() - Arduino Reference

Some things you need to fix in your code. The pinMode statements go in the setup function. Pins are generally either input or output, and rarely change during the program. So, they are set in setup, which is executed once, not in loop, which is executed many, many times.

The if statements are missing a function call. I think you left out digitalRead and some parentheses.

You need to add some variables to hold the time that the button state changes occur. They are long ints:

unsigned long startTime;
unsigned long stopTime;
unsigned long elapsedTime;

These go before the setup function. You also want to keep tracked of whether both buttons have been pushed. The concept of elapsed time implies that one event occurred (the start button was pushed) and then another event occurred (the stop button was pushed). The elapsed time is computed only after both events occur. So, add:

boolean started = false;
boolean stopped = false;

These also go before the setup function.

Then, you need to handle the start button being pushed:

if(digitalRead(startPin) == HIGH) // The start button was pushed
{
   started = true;         // Note that the start button has been pushed
   startTime = millis(); // Note when the button was pushed
}

This goes inside loop. Add a similar block for the stop button.

Then, you need to see if both buttons have been pushed.

if(started && stopped)
{
   elasped = stopTime - startTime; // How long did that take?
   Serial.print("Elapsed time, in milliseconds: ");
   Serial.println(elapsed);

   started = false;  // Reset so starting and stopping can happen again
   stopped = false;
}

Thankyou that has been very helpfull, however now when I verifie the code it tells me that when I reach this point : if(digitalRead(startPin) == HIGH)
This error is displayed: In function 'void loop()':
error: 'startPin' was not declared in this scope

What does this mean and how can I deal with it?

Please post all of your code.

OK here it is

unsigned long startTime;
unsigned long stopTime;
unsigned long elapsedTime;
boolean started = false;
boolean stopped = false;

void setup()
{
int startPin = 1;
int stopPin = 2;
pinMode(stopPin, INPUT);
pinMode(startPin, INPUT);
digitalRead;
Serial.begin(9600);
}

void loop(){
if(digitalRead(startPin) == HIGH) // The sensor has been activated
{
started = true; // If this is ture start the timer
startTime = millis(); // States when the senor has been crossed
}

if(digitalRead(stopPin) == HIGH) // The sensor has been activated
{
stopped = true; // If this is ture start the timer
stopTime = millis(); // States when the senor has been crossed
}
if(started && stopped)
{
elasped = stopTime - startTime; // How long did that take?
Serial.print("Elapsed time, in milliseconds: ");
Serial.println(elapsed);

started = false; // Reset so the senors can be tripped again
stopped = false;
}

void setup()
{
int startPin = 1;                
int stopPin = 2;
pinMode(stopPin, INPUT);
pinMode(startPin, INPUT);
digitalRead;
 Serial.begin(9600);
}

Between your initial post and this one, you moved the declarations for startPin and stopPin from outside of setup to inside of setup.

That changed them from global variables, available to any function (setup, loop, and any functions you develop) to local variables, available only to the function that they are defined in (setup, in this case). Local variables (startPin in setup) are not available to other functions, like loop.

Move the int startPin and int stopPin lines out of startup (move them before it), so they become global variables again.

By the way, the digitalRead statement in setup does nothing. No pin is defined for it to read from, and no place is defined for it to put it's output (not that it has any). Delete it.