Example code will not compile for Video Game Shield

Hello,
I just finished soldering up the Video Game Shield, I am super excited to start working with it, but I can’t get any of the example code to compile. It seems that I don’t have some needed .h files? see the error message below.

What am I doing wrong?
Mac OSX 10.10.2

In file included from /Users/currentuser/Downloads/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/io.h:99:0,
from /Users/currentuser/Documents/Arduino/libraries/TVout/TVout.h:35,
from /Users/currentuser/Documents/Arduino/libraries/TVout/TVout.cpp:35:
/Users/currentuser/Documents/Arduino/libraries/TVout/TVout.cpp:816:16: error: ‘WGM21’ was not declared in this scope
TCCR2A |= _BV(WGM21);

Error compiling.

Hey there, sorry to hear that the code isn’t compiling for you. What kind of Arduino are you using? The TVout library has some pretty low-level assembly code routines that have been hand-optimized for specific AVR chips. We have used the Video Game Shield with both Arduino Duemilanove and Uno without issue. I’ve also played around with the TVout library on the Arduino Mega 2560 with good success.

Hi Layne,
Thanks for the snappy reply.

I’ve got an Uno, a Micro, and a knock-off Funduino Mega 2560, I can’t get the code to compile regardless of which board I choose.

I’m going to try installing the arduino IDE on a PC and see if it goes any better.

Okay, So I installed the arduino IDE on a PC running Windows 7 and almost everything is working fine for the UNO now!

I still can’t get the Raycaster example to compile, but everything else I’ve tried loads fine.

So far having a blast! Nice little shield, easy build, and lots of example material to work with.

I love that there is controller support built in, but I’m also going to try to make a game that responds to audio input as well.

Thanks again!

Excellent, I’m glad it’s working for you on Win 7. It’s still really weird that it wasn’t working on your OSX install, usually Arduino is pretty good about cross-platform interoperability. I’m going to ask @wayne to take a look on his mac. Which version of Arduino were you using on OSX?

What version of Arduino were you using? It seems like there’s been a new 1.6 every week for the last few weeks…

I’ve been having trouble using the video game shield with the Arduino Leonardo, which has the same processor as the mega, and almost the same layout as the Uno. The only error I get with every example is a fatal error where one of the files from the properly installed libraries cannot be found, such as TVout.h.

Hi @Chris_Cramer,

The Arduino Leonardo is based on the ATmega 32u4 (https://www.arduino.cc/en/Main/ArduinoBoardLeonardo), while the Mega either uses the ATmega1280 or the ATmega2560. (https://www.arduino.cc/en/Main/ArduinoBoardMega)

However, it looks like the newest version of the TVout library supports the Leonardo, albeit on a different pin for video than the Uno.

Let me know if you’re interested in that and I can test the changes and write instructions for you.

Thanks!

It is not the Bricktronics shield I am concerned about. I am wondering if there is an updated version of the libraries for the Video game shield, it is not only the TVout library that can’t be found. Every example I try to compile results in a fatal error for a single file, TVout.h, ic2master.h, etc; so is there any way I can either modify my board, or update the libraries, to make this work properly.

Hi Chris, sorry for the confusion about the Bricktronics Shield, wayne was confusing himself and edited his response to remove the confusion.

We have never tried the Video Game Shield with the Leonardo. I understand that the TVout library only recently added support for the Leonardo, so I will give it a try this weekend to see how it goes. The shield will definitely need a small modification to re-route the video signal source to the correct pin on the Leonardo.

I just tried to compile the TVout NTSC example for Leonardo, and it ran into the expected errors about missing definitions:

/home/matthew/Arduino/libraries/TVout/video_gen.cpp: In function 'void render_setup(uint8_t, uint8_t, uint8_t, uint8_t*)':
/home/matthew/Arduino/libraries/TVout/video_gen.cpp:89:2: error: 'DDR_VID' was not declared in this scope
  DDR_VID |= _BV(VID_PIN);
  ^

If you are seeing errors about missing TVout.h or i2cmaster.h files, that indicates that the libraries are not installed in the right place. It’s a little confusing, but the Video Game Shield ZIP archive and GitHub repository contain multiple libraries (like TVout, TVoutfonts, Nunchuck, etc). These folders all need to be inside your Arduino sketchbook’s “libraries” directory, and can’t be inside a Video-Game-Shield directory. Hopefully that makes sense, let us know if you have questions.

To conclude, it’s not expected that the VGS kit will work with the Leonardo, but I’ll take a look at it this weekend to see if I can get it working.

I’ve found a way to support the Leonardo by modifying the hardware setup file in the TVout library. I changed the processor to ATmega 32u4, and I changed the VID pin to 4//8, and the SND pin to 7//11. The sketches successfully compiled and uploaded, but they do not show up on screen. Is this because the signal still doesn’t make it to the correct pin through the hardware, or should the program be able to guide the signal to the video/audio connectors by the way I programed the hardware setup?

Hi Chris,

The TVout library is a really low-level library, that relies on the underlying AVR hardware for generating the very timing-sensitive video and sync signals, instead of using the Arduino pin mapping methods. The TVout library can only use a single specific pin on each processor for the video and sync signals, due to the timer hardware on that processor.

You’ll need to modify your Video Game Shield to re-route the signal source to the correct place on the shield to drive the resistors that drive the RCA outputs. Fortunately, of the three TVout signals (sync / video / audio), only the video pin changes from Arduino pin 7 to pin 8. You can solder a small jumper wire between the empty holes next to Arduino pins 7 and 8.
(In this image, solder the red wire’s other end into the hole labeled 8).

This means that your D7 an D8 pins are connected together, so don’t do anything with D7, and leave it set as an input pin.

This branch of the TVout library has been update to support the Leonardo, so you might want to clone the git library into your sketchbook libraries folder and try it out: https://github.com/Avamander/arduino-tvout/

Let us know how it goes!

Hi I’ve finally got the TVout examples working, but what’s next is the none of the examples respond to neither the nunchuck nor the classic controller. The sketches upload successfully onto the board, and the title screen shows up, but it wont respond to the controllers’ connection, or even send serial data back to my pc.

Hi Chris, I think the Nunchuck and Classic Controller issues are due to the fact that the Leonardo has its I2C pins in a different location than the Uno. The Uno has the I2C signals on Analog 4 and 5, while the Leonardo has them on Digital 2 and 3 (in addition to the special Arduino Rev 3 dedicated I2C pins).

You could try to jump a wire from A4 to D3 and from A5 to D4, then ensure that you don’t use A4 and A5 (leave them as inputs). This should connect the actual I2C signals to the pins where the shield expects them. Hope that makes sense, let me know if you have questions.

Hi Layne, I’ve actually turned to the Uno R3. It turned out the issue with the Leonardo was the board it’s self, not even the blink sketch would work. I still tried what you said on the Uno R3, but there is still no communication with the nunchucks in any of the video game examples.

If you are using an Uno R3, then the Video Game Shield should work just fine without modifications.

I am also having troubles with the VGS when I compile tetris I get:
Arduino: 1.6.7 (Windows 7), Board: “Arduino/Genuino Uno”
tones.h:119: error: ‘prog_uint16_t’ does not name a type
PROGMEM const prog_uint16_t melody[] =

I can confirm that the tetris example does not compile on Arduino 1.6.7 on Windows 10, for target “Arduino/Genuino Uno”. It complains about the prog_uint16_t type. I’ll start working to fix this later today. Thanks for the bug report!

It appears that Arduino recently upgraded the version of the underlying avr-gcc compiler, which changed some of the variable types used for putting data into the flash memory (PROGMEM). I have updated several of the examples to work with the latest Arduino IDE version. The latest version of the VGS libraries are always available here in our GitHub repository:

I have also updated the all-in-one ZIP archive available at the top of this page:
https://www.wayneandlayne.com/projects/video-game-shield/download/

Please give that a try and let us know how it goes.

Sorry, I have not been able to test it very quickly. The program does not throw any errors now which is great but, it seems the nunchucks are not sending back data for me.