Hello,
I am currently working on a project that involves using E-prime to synchronize behavioral and EEG data. Specifically, we are recording EEG data from infants and require a method to mark the starting and ending points of each recording. To achieve this, I would like to implement a functionality where pressing a button in E-prime sends a trigger to the EEG recording computer. This trigger will serve as a reference point for later data extraction.
In essence, I am seeking assistance in configuring E-prime to send triggers without the need for an introduction or thank you page, as the program is intended for the experimenter who will be sending the triggers. Here is the challenge I am facing:
I have attempted to utilize the "task event" function and inline scripting, but unfortunately, both approaches have been unsuccessful. I have attached the script below for your reference. I would greatly appreciate any guidance or support you can provide to resolve this issue. Is it possible to achieve this functionality in E-prime? Or does it require the presence of a stimulus?
Thank you for your attention and assistance in advance. I look forward to your response.
Best,
Cody
Attached Script:
Imports System.IO.Ports ' Import the necessary namespace for serial port communication
Sub Main
Dim Response As String
Dim TriggerCode As Integer
' Replace "COM1" with the appropriate port name for your parallel port
Using port As New SerialPort("COM1", 9600)
TriggerCode = 1 ' Replace with the appropriate trigger code for your setup
port.Open() ' Open the serial port connection
While True
Response = EIS.GetKeyboardString()
If Response = "b" Then
' Send trigger code via the parallel port
port.WriteLine(TriggerCode.ToString())
End If
End While
port.Close() ' Close the serial port connection
End Using
End Sub
Main() ' Call the Main subroutine