Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to connect to AnalogInput Module after stopping previous session
Dear Bpod Users,
I am new here and slowly trying to read into the bpod scripts.
For some time now, I have been having problems starting a new session after previously ending the previous session via stop button.
I get the following error message:

Error in Light2AFC_AnalogStreaming (line 47)
    A = BpodAnalogIn(BpodSystem.ModuleUSB.AnalogIn1);

Error in run (line 91)
evalin('caller', strcat(script, ';'));

Error in NewLaunchManager>LaunchProtocol (line 717)
Error while evaluating DestroyedObject Callback

Is it because the AnalogInput module is not exiting properly? I also get this error message when I run the test script "Light2AFC_AnalogStreaming"
The last lines of code look like this:

    RawEvents = RunStateMatrix;  
    if ~isempty(fieldnames(RawEvents)) % If trial data was returned
        BpodSystem.Data = AddTrialEvents(BpodSystem.Data,RawEvents); % Computes trial events from raw data
        BpodSystem.Data.TrialSettings(currentTrial) = S; % Adds the settings used for the current trial to the Data struct (to be saved after the trial ends)
        BpodSystem.Data.TrialTypes(currentTrial) = TrialTypes(currentTrial); % Adds the trial type of the current trial to data
        UpdateSideOutcomePlot(TrialTypes, BpodSystem.Data);
        SaveBpodSessionData; % Saves the field BpodSystem.Data to the current data file
    HandlePauseCondition; % Checks to see if the protocol is paused. If so, waits until user resumes.
    if BpodSystem.Status.BeingUsed == 0
        A.scope_StartStop; % Stop Oscope GUI
        A.endAcq; % Close Oscope GUI
        A.stopReportingEvents; % Stop sending events to state machine

Does anyone have a solution for this? 
Many thanks in advance

Forum Jump: