tvout help with serial

i have ran into a bit of trouble with a bit of code. it involves tvout and serial. the problem is that when i use the println function on a word it enters between every letter. is there a way to make it enter after the whole word?

#include <TVout.h>
#include <fontALL.h>
TVout TV;
const int buttonPin = 2;
const int ledPin =  13; 
        // the current state of the output pin
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin
int ledState = HIGH;  
// the following variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers
void setup() {
  TV.begin(NTSC,120,96);
  TV.select_font(font6x8);
  TV.println("Starting MS-DOS...");
  delay(5000);
  TV.println("Ready");
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
if (Serial.available()) {
 TV.println((char)Serial.read());
}
  // read the state of the switch into a local variable:
  int reading = digitalRead(buttonPin);

  // check to see if you just pressed the button 
  // (i.e. the input went from LOW to HIGH),  and you've waited 
  // long enough since the last press to ignore any noise:  

  // If the switch changed, due to noise or pressing:
  if (reading != lastButtonState) {
    // reset the debouncing timer
    lastDebounceTime = millis();
    TV.clear_screen();
  } 
  
  if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    buttonState = reading;
  }
  
  // set the LED using the state of the button:
  digitalWrite(ledPin, buttonState);

  // save the reading.  Next time through the loop,
  // it'll be the lastButtonState:
  lastButtonState = reading;
}

the function println(); prints your data plus '\n' which meens that it starts on a new line, what you probably want is just print(); and then when your determine your data is done/the end of your data you do a println("");

hope it helps :) try it with print(); and println();

Slight change like you said. like this?

void loop() {
if (Serial.available()) {
 TV.print((char)Serial.read());
 TV.println("");
}

if not correct, how do i determine when i am finished

how do i determine when i am finished

You are never finished loop() repeats forever, well until you remove the power.

i should rephrase that. like he said when the data is done

and then when your determine your data is done/the end of your data you do a println("");

how do i do that?

One conventional way is using the ASCII carriage return or line feed character. So when you see one of these ( value 10 or 13 ) then you add the '\n'

i should also of noted im not that great with the IDE either. so i have now clue as to what you just said

so i have now clue as to what you just said

Well I am not sure what sort of answer you expect.

Can you understand this:- change the TV.println( to TV.print(

Well he could create a loop him self, like:

while(Serial.available){
   TV.print((char)Serial.read());
}
TV.prinln("");

or if you read a '\n' as mike said:

while(Serial.available){
   if((char)Serial.read()=='\n'){
      TV.println("");
   }
   else{
      TV.print((char)Serial.read());
   }
}

So i hope it helps :)

almost, except i get this

DOS:25: error: could not convert 'Serial.HardwareSerial::available' to 'bool'

Heres the latest code btw

#include <TVout.h>
#include <fontALL.h>
char Str1[15];
TVout TV;
const int buttonPin = 2;
const int ledPin =  13; 
        // the current state of the output pin
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin
int ledState = HIGH;  
// the following variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers
void setup() {
  TV.begin(NTSC,120,96);
  TV.select_font(font6x8);
  TV.println("Starting MS-DOS...");
  delay(5000);
  TV.println("Ready");
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  while(Serial.available){
   if((char)Serial.read()=='\n'){
      TV.println("");
   }
   else{
      TV.print((char)Serial.read());
   }
}
  // read the state of the switch into a local variable:
  int reading = digitalRead(buttonPin);

  // check to see if you just pressed the button 
  // (i.e. the input went from LOW to HIGH),  and you've waited 
  // long enough since the last press to ignore any noise:  

  // If the switch changed, due to noise or pressing:
  if (reading != lastButtonState) {
    // reset the debouncing timer
    lastDebounceTime = millis();
    TV.clear_screen();
     TV.println("Starting MS-DOS...");
  TV.println("Ready");
  } 
  
  if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    buttonState = reading;
  }
  
  // set the LED using the state of the button:
  digitalWrite(ledPin, buttonState);

  // save the reading.  Next time through the loop,
  // it'll be the lastButtonState:
  lastButtonState = reading;
}

Serial.available is a function pointer - it will always be true. You need to call it. Serial.available()

how do i call it?
Serial.begin(9600);?

#include <TVout.h>
#include <fontALL.h>
TVout TV;
const int buttonPin = 2;
const int ledPin =  13; 
        // the current state of the output pin
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin
int ledState = HIGH;  
// the following variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers
void setup() {
  TV.begin(NTSC,120,96);
  TV.select_font(font6x8);
  TV.println("Starting MS-DOS...");
  delay(5000);
  TV.println("Ready");
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
while(Serial.available()) {
 if((char)Serial.read()=='\n'){
      TV.println("");
   }
   else{
      TV.print((char)Serial.read());
   }
}
  // read the state of the switch into a local variable:
  int reading = digitalRead(buttonPin);

  // check to see if you just pressed the button 
  // (i.e. the input went from LOW to HIGH),  and you've waited 
  // long enough since the last press to ignore any noise:  

  // If the switch changed, due to noise or pressing:
  if (reading != lastButtonState) {
    // reset the debouncing timer
    lastDebounceTime = millis();
    TV.clear_screen();
  } 
  
  if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:
    buttonState = reading;
  }
  
  // set the LED using the state of the button:
  digitalWrite(ledPin, buttonState);

  // save the reading.  Next time through the loop,
  // it'll be the lastButtonState:
  lastButtonState = reading;
}

updated code gives japanese characters

how do i call it?

I just showed you.

Check how you read it. Once you've read it, it isn't available to read again, so you need to store it.

so it would be void loop() { (Serial.available()) { if((char)Serial.read()=='\n'){ TV.println(""); } else{ TV.print((char)Serial.read()); } }

No, you're reading it twice.

i honestly have no clue on how to do this. i barely know C if any

There is no need to do anything. Think about it what that code does:-

void loop() {
(Serial.available()) {
 if((char)Serial.read()=='\n'){
      TV.println("");
   }
   else{
      TV.print((char)Serial.read());
   }
}

It say if you get a CR then print a CR with a TV.println But if you get a CR then simply printing it like the other characters is going to work the same.

So all you need is:-

void loop() {
      TV.print((char)Serial.read());
}

shame on me! that had to Serial.available() !!!

Grumpy_mike depends on the tvout library no? (unless it uses print.h) then yes, grumpy_mikes solution is most elegant!

depends on the tvout library no?

Well if it is using the .print and the .println class then it will work.

What is actually important is the source of the serial data and if it contains any CR or LF characters. The OP has not said much about where the data that arrives through the serial port is coming from.