# Hardware Acquisition Triggers via an Event

A Camera Device can be configured to perform an acquisition by being triggered by another hardware device, such as a photoelectric sensor (aka photo eye), via the Event setting of the Task Mode. This in turn can be used to execute a Task.

To execute a Task when a camera is triggered via hardware:

1. In the OnStartup script (or a User Scripts), add the following code:

       $Devices.Camera1.TriggerModel = CogAcqTriggerModelConstants.Auto;
       $Tasks.Task.TriggerEnabled = true;

2. Configure the Task Mode property of the Task:

   1. From the Project Explorer, right-click the desired Task and select Properties from the menu.

   2. In the Task Mode dialog, select Event and Devices.<CameraName>.ImageAcquired.