Accepting Serial Input from Keyboard as interrupt

I have done the following temperature sensor tutorial http://tronixstuff.wordpress.com/2010/04/15/getting-started-with-arduino-chapter-two/ and would like to run the continuous output to print to the screen or an LCD. Is is possible to listen for serial input through the keyboard and use that as an interrupt for the main loop?

Thanks in advance

You'll have to elaborate more on what you're looking at doing. That tutorial already prints to the screen. It's entirely possible to listen and accept commands from the serial interface, but to what end? What do you mean by interrupt the main loop? There's plenty of built in examples of using both ends of the Serial communication as well as printing to an LCD screen.

Do you mean something like:

void loop() {
   If (Serial.available()) {
      ProcessSerialInput();
   } else {
      ReadTemp();
      DisplayTemp();
   }
}

Basically I combined the temperature sensor tutorial and the shift register tutorials. The temperature sensor is sending back information at the top of every loop. Further down in the loop it gets hung while waiting for a number coming in as serial input. The number determines which LED off the shift register to turn on. I'd like it to continue sending temperature data until it sees something inbound through the serial connection.

Then you should be able to wrap your serial code in

if (Serial.available()) {
...
}

You are very right. I had some some bad syntax that was getting in the way. your solution will worked perfect.

Thank you very much for your help

M.