We are having issues with logging data from our Joystick serial port device.
The serial port device is connected properly and is able to send output correctly to the output files and DataAid files but is only able to do so if it is stimulated (i.e., moved up or down, in the case of our Joystick) during the period in between our Initializing InLine text and our Recording InLine text.
Put in the terms of our experiment, our E-Prime is set-up to display a “Start Joystick” text object before our Joystick Procedure (which we understand to be the InLine text instructing the serial port device to be initializing and preparing to log data). Following this text object, is a blank screen that appears on E-Prime while the serial port device is initializing. We are seeing that, during our experimental trials, outputs from the serial port device are logged only if the Joystick is initially moved while the blank screen appears. That is, the Joystick seemingly needs to be ‘woken up’ during this period so that it can later collect output data
If the Joystick is NOT moved during this period, and subsequently moved during our experimental trials, the output data will not be logged.
Below are our two sets of code:
Initializing Joystick In-Line Code
‘Just hold the experiment here until some bytes arrive over the serial port.
Dim str As String
Dim n As Long
Dim i As Integer
Debug.TimeStampEnabled = True
Debug.Print “Start Joystick”
Do While Serial.InputCount = 0
‘ Read the data that came in
n = Serial.ReadString(str)
‘Echo the data to the E-Studio output window
Debug. Print “Received:” & str
RecordJoystick InLine Code
‘Send the subject’s response key to the remote terminal.
‘Echo the key sent to the E-Studio output window.
Debug.Print “Sent:” & n
‘Log the data being sent
c.SetAttrib “SerialOutputData”, n
‘Finding the first initial points of the joystick input
For i = 1 To Len(str)
If Mid (str, i, 5) = “start” Then
str = Mid (str, i+5, Len)str)-(i+4))
‘Extracting the first datapoint of the joystick input
For i - 1 To Len(str)
If Mid (str, i, 4) = “stop” Then
str = Mid (str, 1, i-1)
‘Log the Serial data as an Attribute
c.setAttrib “SerialInputData”, str
c.setAttrib “SerialInputData+Corrected”, Int(str) – 10
If you have insight on why our serial port device is only able to record if stimulated during this period or see issues with any of our InLine coding, please let us know. Our goal is to have it so that the participants data is logged when their trials begin, regardless of if the Joystick was previously moved.
Please sign in to leave a comment.