Buongiorno,
Vorrei usare la libreria TVout per scrivere le informazioni del mio codice su di un TV invece che sul Serial Monitor. Ho fatto tutto il necessario per configurare la libreria, ho collegato l'RCA al TV e testando l'esempio "DemoPAL" fornito come esempio della libreria funziona tutto come sperato. Il problema sorge quando implemento le funzione della libreria nel mio codice.
Il codice è questo:
#include <boarddefs.h>
#include <IRremote.h> //libreria telecomando per controllare funzioni in Arduino
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <Wire.h>;
#include <Arduino.h>
#include <TVout.h> //libreria TVout
#include <fontALL.h>
TVout TV;
int val = 0;
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
//
//VARIABILI TELECOMANDO
//
float bPOW = 0xE0E040BF; //ON/OFF
float bHDMI = 0xE0E0D12E; // HDMI
float bSOU = 0xE0E0807F; // SOURCE
float bONE = 0xE0E020DF; // 1
float bTWO = 0xE0E0A05F; // 2
float bTHRE = 0xE0E0609F; // 3
float bFOUR = 0xE0E010EF; // 4
float bFIVE = 0xE0E0906F; // 5
float bSIX = 0xE0E050AF; // 6
float bSEVE = 0xE0E030CF; // 7
float bEIGH = 0xE0E0B04F; // 8
float bNINE = 0xE0E0708F; // 9
float bZERO = 0xE0E08877; // 0
float bUP = 0xE0E006F9; // FRECCIA SU
float bDOWN = 0xE0E08679; // FRECCIA GIù
float bLEFT = 0xE0E0A659; // FRECCIA SINISTRA
float bRIGH = 0xE0E046B9; // FRECCIA DESTRA
float bOK = 0xE0E016E9; // TASTO OK
float bPLAY = 0xE0E0E21D; // PLAY
float bINFO = 0xE0E0F807; // INFO
float bRED = 0xE0E036C9; // ROSSO
float bGRE = 0xE0E028D7; // VERDE
float bBLU = 0xE0E06897; // BLU
float bRET = 0xE0E01AE5; // RETURN
float bMENU = 0xE0E058A7 ; // MENU'
//RGB PROCESSING-1
unsigned char MAT = 0; //
unsigned char EBB = 0;
unsigned char SBL = 0;
unsigned char RBL = 1;
unsigned char BLS = 0;
unsigned char BKS = 0;
unsigned char IE1 = 1;
unsigned char IE2 = 1;
//RGB PROCESSING-2
unsigned char MUS = 0;
unsigned char FBC = 1;
unsigned char OBL = 0;
unsigned char AKB = 0;
unsigned char CL3 = 0;
unsigned char CL2 = 0;
unsigned char CL1 = 0;
unsigned char CL0 = 0;
//Wide Horizontal Blanking
unsigned char HBL = 1;
unsigned char TFBC = 1;
unsigned char GAI = 0;
unsigned char STB0 = 1;
unsigned char HB3 = 0;
unsigned char HB2 = 1;
unsigned char HB1 = 1;
unsigned char HB0 = 1;
//Horizontal Deflection
unsigned char HDTV = 1;
unsigned char VSR = 0;
unsigned char ZERO = 0;
unsigned char STB1 = 1;
unsigned char POC = 0;
unsigned char PRD = 1;
unsigned char VGA = 0;
unsigned char ESS = 1;
//Vertical Deflection
unsigned char OPC = 0;
unsigned char VFF = 0;
unsigned char LBM = 0;
unsigned char DIP = 1;
unsigned char OSO = 0;
unsigned char SVF = 1;
unsigned char EVG = 1;
unsigned char DL= 1;
//Brightness
unsigned char cBRI;
//Saturation
unsigned char cSAT;
//Contrast
unsigned char cCON;
//White Point R
unsigned char cWPR;
//White Point G
unsigned char cWPG;
//White Point B
//Peak White Limiting
unsigned char cPWL;
//Horizontal Shift
unsigned char cHSHIFT;
//Horizontal Parallelogram
unsigned char cHPA;
//E-W width
unsigned char cEWW;
//E-W parabola/width
unsigned char cEWP;
//E-W upper corner/parabola
unsigned char cEWUC;
//E-W trapezium
unsigned char cEWT;
//E-W EHT compensation sensitivity
unsigned char cEWC;
//Vertical Slope
unsigned char cVSLO;
//Vertical Amplitude
unsigned char cVAMP;
//S-Correction
unsigned char cSCO;
//Vertical Shift
unsigned char cVSH;
//Vertical zoom
unsigned char cVZO;
//Vertical scroll
unsigned char cVSC;
//Vertical wait
unsigned char cVWA;
//DAC Output
unsigned char cDAC;
//Black level offset R
unsigned char cBLR;
//Black level offset G
unsigned char cBLG;
//Horizontal timing
//E-W Lower corner/parabola
unsigned char cEWLC;
//Horizontal Bow
unsigned char cHOB;
// Unione delle variabili in Byte
unsigned char RGB1= MAT<<7 | EBB<<6 | SBL<<5 | RBL<<4 | BLS<<3 | BKS<<2 | IE1<<1 | IE2<<0;
unsigned char RGB2= MUS<<7 | FBC<<6 | OBL<<5 | AKB<<4 | CL3<<3 | CL2<<2 | CL1<<1 | CL0<<0;
unsigned char WHD= HBL<<7 | TFBC<<6 | GAI<<5 | STB0<<4 | HB3<<3 | HB2<<2 | HB1<<1 | HB0<<0;
unsigned char HD= HDTV<<7 | VSR<<6 | ZERO<<5 | STB1<<4 | POC<<3 | PRD<<2 | VGA<<1 | ESS<<0;
unsigned char VD= OPC<<7 | VFF<<6 | LBM<<5 | DIP<<4 | OSO<<3 | SVF<<2 | EVG<<1 | DL<<0;
void setup()
{
TV.begin(PAL,120,96); //inizializza Standar PAL
TV.select_font(font6x8); //usa carattere 6x8
TV.println("CRT-INO"); //stampa scritta
TV.delay(2000);
TV.println();
TV.print("RGB1: ");
TV.println(RGB1);//Verifica i numeri
TV.print("RGB2: ");
TV.println(RGB2);
TV.print("WHD: ");
TV.println(WHD);
TV.print("HD: ");
TV.println(HD);
TV.print("VD: ");
TV.println(VD);
TV.println();
//disabilita le resistenze di Pull-Up
digitalWrite(A4, LOW);
digitalWrite(A5, LOW);
//ablita sensore IR
TV.delay (2000);
irrecv.enableIRIn();
TV.println("Telecomando Abilitato");
}
void loop()
{
}
Così com'è il codice non funziona. Non stampa le scritte nel setup, lo schermo rimane nero
Semplificando di molto il codice, funziona:
#include <Arduino.h>
#include <TVout.h>
#include <fontALL.h>
TVout TV;
int V=12;
void setup()
{
TV.begin(PAL,120,96);
TV.select_font(font6x8);
TV.println("CRT-INO");
TV.delay(2000);
TV.println();
TV.print("RGB1: ");
TV.println();//Verifica i numeri
TV.print("RGB2: ");
TV.println();
TV.print("WHD: ");
TV.println();
TV.print("HD: ");
TV.println();
TV.print("VD: ");
TV.println();
TV.println();
}
void loop() {
}
Chiedo gentilmente aiuto in quanto non capisco dove sta l'errore.
Grazie
Andrea