Receiving and processing serial ASCII strings

Hi,

I'm working on a project which involves taking serial ASCII data from a sensor and overlaying it on a video stream.

I have the Nootropic Design Video Experimenter board (Video Experimenter: Arduino shield that lets you do all kinds of experiments with video)

I am currently sending my ASCII commands from my computer via Serial Monitor and USB.

The problem I'm having is that my code only seems to store individual characters, not the entire string. For example, if I send 'hello' from the computer, the video overlay displays only 'o'. If I send '12345', I just get '5'.

I believe I have to read the string into a buffer and display from that buffer. I've been googling and testing for hours and can't crack it. I've tried using String instead of Char, and also adding [20] to Char etc, but I'm not getting anywhere. The TVout function will not print Strings, only Char, Int etc.

Here's my code. The Video Experementer setup code at the beginning is largely irrelevant to my problem, but I've posted the whole code anyway:

#include <TVout.h>
#include <fontALL.h>

#define W 136
#define H 96

TVout tv;

unsigned char inData; // data byte to hold incoming data

void setup()  {
  tv.begin(PAL, W, H);
  initOverlay();
  tv.select_font(font6x8);
  tv.fill(0);

  Serial.begin(9600); // Start serial comms
}

// Initialize ATMega registers for video overlay capability.
// Must be called after tv.begin().
void initOverlay() {
  TCCR1A = 0;
  // Enable timer1.  ICES0 is set to 0 for falling edge detection on input capture pin.
  TCCR1B = _BV(CS10);

  // Enable input capture interrupt
  TIMSK1 |= _BV(ICIE1);

  // Enable external interrupt INT0 on pin 2 with falling edge.
  EIMSK = _BV(INT0);
  EICRA = _BV(ISC11);
}

// Required to reset the scan line when the vertical sync occurs
ISR(INT0_vect) {
  display.scanLine = 0;
}

void loop() {
  if (Serial.available() > 0) {
    inData = Serial.read();
    tv.print(0,80,inData);
  }
}

I would really appreciate any help or advise. Has anyone else had success in reading a full ASCII string of, say, 20 characters, then doing something useful with the string?

Many thanks

Ardvino

With out the doc's for "TV" no one can know, at the least post the .h file.

At no point in your code are you doing anything with a string. inData is just a single char!.

    tv.print(0,80,inData); this looks like print the char at 0,80 which will of course put all the chars in the same place.

Mark

You also need to decide what delimts your serial input, I.e. when is it time to stop receiving and start displaying?

(There are lots of examples of how to input multiple characters, but please, use strings, not Strings)

Doesn't the serial reception screw up the video timing?