time between serial inputs

Can anyone direct me to a tutorial that will explain a sketch that will write the intervals between repeated serial inputs to the serial monitor? E.g., the times of occurrence (or the delays between) multiple presses of the same key on a computer.

I know that I have seen it but I cannot relocate the information.

THX

I don't recall a previous question like that (but there may well have been one).

Do you mean that the Arduino should record the value of millis() every time it receives a character from the Serial monitor? That would be easy to do.

Have a go at writing the code and if it does not work post your code and explain what it does do and what it should do.

...R

How are you going to interface your arduino to a computer keyboard. PC keyboards don't use a standard serial interface.

Forgive me if I've got the wrong end of the stick, isn't that what the keyboard serial is about? I've just been working on some code that utilizes key presses aswell.

The keyboard serial example would probaby be a good place to start:

Removing the last two lines of the example code there and putting in some code that regesters what time the key was pressed and/or how long the gap is, and then sending that to the monitor might be what you're after?

If that is what you need you might also want to read about ASCII code (the coding for different pc keyboard key presses.

iron_attorney:
Forgive me if I've got the wrong end of the stick, isn't that what the keyboard serial is about? I've just been working on some code that utilizes key presses aswell.

Ah right you must have a Leonardo, Micro, or Due?

"Do you mean that the Arduino should record the value of millis() every time it receives a character from the Serial monitor?"

Yes, this is what I want to do. Can you direct me to a tutorial...

fprete:
"Do you mean that the Arduino should record the value of millis() every time it receives a character from the Serial monitor?"

Yes, this is what I want to do. Can you direct me to a tutorial...

That sentence was the tutorial !

You will need to provide some more details.
What exactly are you trying to do?
How many times do you want to measure the gap between characters?
About how long will there be between characters?
Remember, to send a single character you need to type the character and press RETURN. If you type several characters before pressing RETURN they will all be sent at the one time and the gap between them will be determined by the baud rate - so there would be no need to measure it.

...R