TVout TV;
int s1 = 0;
int ledPin13 = 13;
int toggle = 0;
void setup()
{
char c;
#if 1
c = TV.begin(PAL,120,96);
TV.select_font(font6x8);
#endif
pinMode(ledPin13, OUTPUT);
TV.println("I am the TVout\nLibrary\n");
TV.delay(2500);
}
void loop()
{
if(toggle == 0)
{
digitalWrite(ledPin13, HIGH); // set the LED on
toggle = 1;
}
else
{
digitalWrite(ledPin13, LOW); // set the LED on
toggle = 0;
}
#if 1
TV.print("s1 is ");
TV.println(s1);
s1++;
TV.delay(100); #endif
}
While it compiles, it doesn't do anything useful. And as the LED isn't being lit in the 'loop' function I assume that something in TV.println in 'setup' is causing it hang.
Also, I am unsure about which pins to be using, all the docs show to use pins 7 and 9.
But, I'm not sure if that's correct for the Duemilanove.
Either way, I don't see any life at all on the PAL TV.
I had another look at the TVOut library today.
After some success with the PONG example on my PAL TV, with my duemilanove atmega168, I tried TVOut library again.
And, I have now got it to work, but with a very much reduced resolution.
The best I can seem to get is using:
TV.begin(PAL, 88, 70);
This gives me 13 columns of 'font6x8' characters, and 8 rows.
But, it only uses up about 2/3 of the screen area. So, it's still not entirely usable.
Is this low resolution due to the low RAM available in duemilanove atmega168?
That would explain it. A resolution of 120x96 needs 12096 bits = 12096/8 bytes = 1440 bytes. The 168p only has 1024 bytes of RAM. 88x70 needs 770 bytes which should fit in just.
Just as I'm starting to make some interesting progress, I am now getting the infamous:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
This is real depressing.
Searching on google and forums for the above text reveals some interesting reliability problems with the arduino platform.
Since my problem isn't related to COM ports or choosing the right target type - I assume that it's the infamous broken bootloader problem. This makes life complicated.
I don't think I can progress any further with a system with this sort of inherent reliability problem.
After some researching on how to re-program the bootloader, I see that an AVR Dragon can be used.
It just happens that I have one in my toy box.
And after about an hour of tinkering I now have a working bootloader in my Duemilanove.
I don't think it's the same one as was pre-programmed when it was delivered because the LED's flash in a different pattern.
But, anyway, I can now get my sketch uploaded to it.
Despite the comments and suggestions from many other people in other forums, the failure to upload was nothing to do with incorrect COM port settings, or stuff like that.
It appears that it's unfortunately easy to trash the bootloader on these things.
Fortunately, this is not a production or professional project - it's a home project.
But, what it has taught me is that the Arduino can't be installed in a production environment due to the inherent reliability problem with the bootloader. Which is a real shame.
But still, I guess it's useful for educational purposes.