3

I'm trying to use Arduino Leonardo with TVOUT library (the only one that I found to do NTSC modulation).

The problem is that I can't even run the example, I searched in serveral forums without a concrete solution, here is the error:

C:\Users\jepser\Documents\Arduino\libraries\TVout\TVout.cpp: In member function 'void TVout::tone(unsigned int, long unsigned int)':
C:\Users\jepser\Documents\Arduino\libraries\TVout\TVout.cpp:825: error: 'DDR_SND' was not declared in this scope
C:\Users\jepser\Documents\Arduino\libraries\TVout\TVout.cpp:825: error: 'SND_PIN' was not declared in this scope
C:\Users\jepser\Documents\Arduino\libraries\TVout\TVout.cpp: In member function 'void TVout::noTone()':
C:\Users\jepser\Documents\Arduino\libraries\TVout\TVout.cpp:876: error: 'PORT_SND' was not declared in this scope
C:\Users\jepser\Documents\Arduino\libraries\TVout\TVout.cpp:876: error: 'SND_PIN' was not declared in this scope

It would be awesome if anyone can help me, with this.

jepser
  • 151
  • 4

2 Answers2

1

Three options.

One, is declaring those 3 variables as global variables in your main file, as valid port + ddr + pin numbers.

Two, declare them as global variables with a 0 value (and don't use the tvout.Tone or tvout.noTone) functions.

Three, edit TVOut.cpp and TVOut.h and remove the tone sections.

Bonus Option, attempt to use the correct procedure by updating the library's definitions. The library had one initial release in 2010 and never got any updates. It's simply not configured for newer atmega chips. See here and here for info on the tvout + leonardo boards, which is entered into the tvout library's hardware_setup.h.

Frankly, if you don't use the Tone function, just declare the variables as 0 and move on.

Passerby
  • 72,580
  • 7
  • 90
  • 202
  • Thanks it was de #if / #elif condition, now it compiles but is not showing anything, any ideas, I did the second link you pasted conditional replacement, but isn't showing anything – jepser Oct 09 '13 at 02:58
0

Try the version of TVout here: http://abcbarryn.github.io/TVout/

It has an updated spec/hardware_setup.h with the following code added:

#elif defined(__AVR_ATmega32U4__) // Modified for Arduino Leonardo
//video
#define PORT_VID    PORTB
#define DDR_VID     DDRB
#define VID_PIN     4 // 8
//sync
#define PORT_SYNC   PORTB
#define DDR_SYNC    DDRB
#define SYNC_PIN    5 // 9
//sound
#define PORT_SND    PORTB
#define DDR_SND     DDRB
#define SND_PIN     7 // 11
#define TCCR2A      TCCR0A
#define TCCR2B      TCCR0B
#define OCR2A       OCR0A
#define OCR2B       OCR0B
#define COM2A0      COM0A0
#define COM2A1      COM0A1
#define CS20        CS00
#define WGM21       WGM01

It also has modification to TVout.cpp

#define TIMER 2

is changed to

#if defined(__AVR_ATmega32U4__)
#define TIMER 0
#else
#define TIMER 2
#endif

This is because the Arduino Leonardo does not have a timer # 2, it has 0,1,3, and 4. Go figure.