Go Down

Topic: tvout help with serial (Read 11148 times) previous topic - next topic

YoshiFan501

#75
Jul 05, 2012, 10:18 pm Last Edit: Jul 06, 2012, 03:33 am by YoshiFan501 Reason: 1
i know what should help me.

the original non-working code that came with the library
Code: [Select]
#include <TVout.h>
#include <pollserial.h>
#include <fontALL.h>

TVout TV;
pollserial pserial;

void setup()  {
  TV.begin(_NTSC,184,72);
  TV.select_font(font6x8);
  TV.println("Serial Terminal");
  TV.println("-- Version 0.1 --");
  TV.set_hbi_hook(pserial.begin(57600));
}

void loop() {
  if (pserial.available()) {
    TV.print((char)pserial.read());
  }
}

and the errors that followed
In file included from NTSCserialTerm.cpp:2:
C:\Program Files\arduino-1.0.1\libraries\pollserial/pollserial.h:46: error: conflicting return type specified for 'virtual void pollserial::write(uint8_t)'
C:\Program Files\arduino-1.0.1\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

Armagedon13

it's not necessary put serial.print to read the signal for tv out. Check my code
Code: [Select]
#include <font4x6.h>
#include <font6x8.h>
#include <font8x8.h>
#include <font8x8ext.h>
#include <fontALL.h>
#include <TVout.h>
#include <video_gen.h>

TVout TV;

// this constant won't change:
const int  buttonPin = 3;    // the pin that the pushbutton is attached to
const int ledPin = 13;       // the pin that the LED is attached to

// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

void setup() {
  TV.begin(PAL,120,96);
  TV.select_font(font8x8);             //seleccionar fuente y tamaƱo
 TV.print(9,44,"Service Naval");     // comando printin pone lo escrito arriba sin modificar
 TV.delay(2500);
 TV.clear_screen();
  // initialize the button pin as a input:
  pinMode(buttonPin, INPUT_PULLUP); //Resistencia de pullup interna
  // initialize the LED as an output:
  pinMode(ledPin, OUTPUT);
  // initialize serial communication:
  Serial.begin(9600);
}


void loop() {
 
  // read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button
      // wend from off to on:
      buttonPushCounter++;
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);
    }
    else {
      // if the current state is LOW then the button
      // wend from on to off:
      Serial.println("off");
    }
  }
  // save the current state as the last state,
  //for next time through the loop
  lastButtonState = buttonState;
  
  // turns on the LED every four button pushes by
  // checking the modulo of the button push counter.
  // the modulo function gives you the remainder of
  // the division of two numbers:
  if (buttonPushCounter % 4 == 0) {
    digitalWrite(ledPin, HIGH);
  } else {
   digitalWrite(ledPin, LOW);
  }
  //nuevo
if(buttonState){
  TV.println( 9, 44, buttonPushCounter);}
}

  

Go Up