In Pylon C# How to Change frameMode to Trigger?

231 Views Asked by At

i want to grab image only when get trigger signal so i have to change basler camera's frameMode to Trigger mode

        hDev = Pylon.CreateDeviceByIndex((uint)0);
        Pylon.DeviceFeatureFromString(hDev, "TriggerSelector", "FrameStart");
        Pylon.DeviceFeatureFromString(hDev, "TriggerMode", "On");

this code got System.Runtime.InteropServices.COMException Error ...

1

There are 1 best solutions below

0
On

Open the camera first:

PylonDeviceOpen( hDev, PYLONC_ACCESS_MODE_CONTROL | PYLONC_ACCESS_MODE_STREAM )

Btw, are you're trying to use pylon C API in managed .NET environment? Looks like bad idea, use .NET interface for it directly: https://docs.baslerweb.com/pylonapi/net/Samples#grab