Can’t include external libraries

Store Forums Video Experimenter Bugs/Problems Can’t include external libraries

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #392
    TerryDiF
    Member

    Hello! I recently purchased the VE shield and it’s been working wonderfully, however I’ve run into a problem: When I try and include an external library other than the ones required for the VE, the code simply does not run.

    Right now I’m trying to include Wire.h, for transmitting data to a second Arduino, but simply adding “#include ” to the top of even the simplest VE project makes the code not run. It stops at the very beginning of setup(). I tried printing out the serial immediately at the start of setup() to see if the code is being run at all. It was meant to print, “Beginning setup” at the start, but it just prints “Be” then stops. No loop(), no rest of setup(). This is fixed and the code runs normally if I comment out the “#include ” line.

    Is this normal? Any help?

    Thanks!
    -Terry

    #1528
    Michael
    Keymaster

    The video processing code (TVOut library) is interrupt driven and depends on very precise timing. Trying to use other interrupt driven protocols will interfere with the Video Experimenter. Basically, it takes all the muscle that the ATmega328 has to generate video with correct timing.

    I successfully used I2C communication with a very trimmed down version of the I2C library when I implemented the Wii nunchuck controller for my Hackvision product. The important part is only doing I2C communication during the vertical blanking interval in the video. That is, the only time you have time to communicate is at the end of each frame.

    See the Hackvision Controllers library (specifically the nunchuck controller) and i2c.c, i2c.h for some info on how to do this. It’s tricky.
    The Controllers library can be downloaded from:
    http://nootropicdesign.com/hackvision/games.html

    #1529
    TerryDiF
    Member

    Hello,

    Thanks for your reply, it was very helpful. Looking at the nunchuck library I can see there are begintransmission, endtransmission, and send functions similar to the Wire library. Would you be able to briefly explain how I could use these in a similar manner, as well as how I should properly connect two Arduinos in order to communicate using these? If not, is there a specific tutorial or example I should look to for how to do this?

    Thanks!

    #1530
    Michael
    Keymaster

    It would be much easier to use serial communication between the Arduinos. TVout comes with a polling version of serial communication (versus interrupt driven). See the “pollserial” library in TVout. There are examples in the “examples” folder.

    This allows you to perform serial communication between the devices even if one is using TVout. Connect RX to TX and TX to RX between the Arduinos. Also connect the grounds. Use pollserial on the Arduino using TVout, and use the normal Serial library on the other Arduino. I’d use a speed of 9600.

    Hope that makes sense. This will allow you to communicate in the easiest manner. I would avoid I2C unless you can find a polling version. My trimmed down I2C implementation is only suitable for very tiny amounts of data (like nunchuck readings).

    #1531
    TerryDiF
    Member

    That sounds good, thank you very much!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.