connection problem

Store Forums Video Experimenter Bugs/Problems connection problem

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #617
    mario
    Member

    Hi Michael,

    I have a project to make an optical length measurement, that requires me to have an overlay in the monitor to see the edge of the object. I already bought the Video Experimenter and Arduino UNO and everything is going well to have such an overlay on the monitor with this two device. But I faced a problem in the next step when the length magnet sensor attached. Is there any possibility to have a communication between Arduino + Video Experimenter to the sensor?The sensor itself has a SSI connection.

    I already tried to make a clock with I2C connection and when I run the Arduino, the clock is flickering(not a sharp clock). I think there is some error in the timers that Video experimenter use to the Oscilloscope. It able to do just one task, I mean I have everything right with the clock without the video experimenter and vice versa. Maybe you have an idea to this problem?

    I really appreciate for your help.

    Regards,

    Mario

    #1655
    Michael
    Keymaster

    Basically, generating a video signal consumes almost the entire CPU of the Arduino and requires very precise timing. It’s hard to use something like I2C at the same time you are generating a video signal.

    If you look closely at the TVout library, there is the ability to attach a function to run during the vertical blanking interval (VBI). Look at this project where I used a Wii nunchuck (I2C) with TVout. http://nootropicdesign.com/projectlab/2011/03/20/tv-blaster/

    It uses my Hackvision controllers library which has a stripped down, simplified I2C implementation that uses less memory. Maybe your sensor will work with simpler I2C implementation.

    #1656
    mario
    Member

    Hi Michael,

    Thank you for your help. Right now I will check the project that you gave me the link above. Maybe it can be used for my project.

    Regards,

    Mario

    #1657
    mario
    Member

    Hi again Michael,

    I see another post that has similar problem like me, and in that post you just giving a guide about the code.

    void setVBIFlag() {
    inVBI = true;
    }
    tv.set_vbi_hook(&setVBIFlag);
    if (inVBI) {
    // communicate with compass here
    inVBI = false; // reset the flag so we only try to communicate once per frame
    }

    Is that right?Because, I’m just using that code inside my code and everything is fine when I’m compile the program, but it still doesn’t have a communication between the sensor and Arduino. It’s like the code never jump to the if (inVBI) part. I don’t have any idea why it is not working. Maybe you have any advise?

    Thank you.

    Best Regards.

    Mario

    #1658
    Michael
    Keymaster

    Instead of passing a function to set the flag, just pass a function that performs the communication. So when you enter VBI, your function gets called and you do the work.

    void readSensor() {
    // read sensor
    }

    tv.set_vbi_hook(&readSensor);
    #1682
    Shulyaka
    Member

    @mario wrote:

    It’s like the code never jump to the if (inVBI) part. I don’t have any idea why it is not working. Maybe you have any advise?

    Make sure inVBI is declared as volatile:

     volatile bool inVBI=false;
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.