Using Serial interrupts

Hi,

I've been trying to write a sketch that continously sends a character and the current micros() value until it gets a Serial input. I want to use it to test Serial communication between two Arduino-boards. One will Send and the other one will reply. However, I need to put some delay between the single transmissions, otherwise I won't be able to see if the last character sent is the one the other board replied to. But if I use the delay function, data received via Serial will not be displayed, when it arrives, but when the loop has finished its next circle. I couldn't find out how to fix this Problem (interrupts didn't work so far). I hope someone can help me.

Look at the blinkWithoutDelay example in the digital examples. It shows you how to create a delay without the delay() command. That, and Serial.available() will do the job. Something like this:

long lastBlinkTime = 0;

void setup() { // do your setup stuff here Serial.begin(9600); }

void loop() { if (Serial.available() > 0) { // do your serial input thing }

long thisTime = millis(); if (thisTime - lastBlinkTime > 1000) { // blink your led here lastBlinkTime = thisTime; } }

Thanks, gave me an new view of the topic. Already got an idea how it may work this way. ;D