Issue with external interrupt

Discussion related to "under the hood" OpenMV topics.
sebastian
Posts: 1
Joined: Wed Feb 14, 2018 6:46 pm

Issue with external interrupt

Postby sebastian » Wed Feb 14, 2018 6:58 pm

Hi,

I'm attempting to trigger a snapshot every time the camera receives a TTL pulse. I keep getting the same error which I believe is related to pin allocation:
ValueError: ExtInt vector 14 is already in use
. Below is my code.

Code: Select all

import sensor, image, time
from pyb import Pin, ExtInt

sensor.reset()                   
sensor.set_pixformat(sensor.RGB565) 
sensor.set_framesize(sensor.QVGA)   
sensor.skip_frames(time = 2000)    
clock = time.clock()                
syncFlag = 0

def callback (line):
    syncFlag = 1
    
while(True):
    ext = ExtInt(Pin('P0'), ExtInt.IRQ_RISING, Pin.PULL_UP, callback)
    if (syncFlag == 1):
        img=image.snapshot()
        syncFlag = 0
User avatar
kwagyeman
Posts: 1401
Joined: Sun May 24, 2015 2:10 pm

Re: Issue with external interrupt

Postby kwagyeman » Wed Feb 14, 2018 7:59 pm

Don't create the interrupt in the loop. Make it outside of the loop.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest