Welcome, Guest
You have to register before you can post on our site.

Search Forums

(Advanced Search)

Forum Statistics
» Members: 27
» Latest member: PH
» Forum threads: 198
» Forum posts: 718

Full Statistics

Online Users
There are currently 4 online users.
» 0 Member(s) | 4 Guest(s)

Latest Threads
ArCOM error when uploadin...
Forum: Software
Last Post: millenialfalcon
10-12-2019, 11:02 PM
» Replies: 0
» Views: 23
Control external serial d...
Forum: Hardware
Last Post: Josh
10-12-2019, 06:13 PM
» Replies: 1
» Views: 65
Air puff
Forum: Hardware
Last Post: Bowey
10-11-2019, 12:49 AM
» Replies: 2
» Views: 95
threshold events and rota...
Forum: Software
Last Post: Jeff
10-10-2019, 05:17 PM
» Replies: 3
» Views: 1,144
Sync camera with Bpod
Forum: Software
Last Post: Josh
10-10-2019, 02:47 AM
» Replies: 1
» Views: 56
Waveform size of 8ch outp...
Forum: Software
Last Post: Meowater
10-08-2019, 04:45 PM
» Replies: 2
» Views: 59
Sync Bpod with microscope...
Forum: Software
Last Post: Josh
10-08-2019, 06:07 AM
» Replies: 9
» Views: 1,792
Change sma (e.g. value of...
Forum: Software
Last Post: Josh
09-18-2019, 06:19 PM
» Replies: 1
» Views: 96
TriggerProfiles for 8 cha...
Forum: Software
Last Post: owen
09-17-2019, 12:56 PM
» Replies: 2
» Views: 130
Parallel state machine an...
Forum: Software
Last Post: ziyi
09-16-2019, 02:45 PM
» Replies: 2
» Views: 117

  ArCOM error when uploading to Arduino
Posted by: millenialfalcon - 10-12-2019, 11:02 PM - Forum: Software - No Replies

Hi, Josh and other Bpod users.

I would like to integrate some hardware I have wired up using an arduino to my Bpod state machine.
I took the example code from the Github (Bpod_Gen2-master\Examples\Firmware\Bpod Shield\DIO) and tried uploading it to my arduino uno. However, I obtain a "prototype for '`' does not match any class in 'ArCOM' " error. I have attached the full error message below. How can I address this error?

I have seen a similar error previously when there was a header file class and .cpp file discrepancy, but I'm a little lost on how to proceed. Any feedback would be appreciated!

Arduino: 1.8.9 (Windows Store (Windows 10), Board: "Arduino/Genuino Uno"

ArCOM.cpp:42:6: error: prototype for 'void ArCOM::writeUint16(short unsigned int)' does not match any in class 'ArCOM'

void ArCOM::writeUint16(unsigned short int2Write) {


In file included from sketch\ArCOM.cpp:22:0:

ArCOM.h:44:8: error: candidate is: void ArCOM::writeUint16(uint16_t)

  void writeUint16(uint16_t int2Write);


ArCOM.cpp:65:16: error: prototype for 'short unsigned int ArCOM::readUint16()' does not match any in class 'ArCOM'

unsigned short ArCOM::readUint16() {


In file included from sketch\ArCOM.cpp:22:0:

ArCOM.h:54:12: error: candidate is: uint16_t ArCOM::readUint16()

  uint16_t readUint16();


DIO:29:18: error: 'Serial1' was not declared in this scope

ArCOM Serial1COM(Serial1); // Wrap Serial1 (UART on Arduino M0, Due + Teensy 3.X)


ArCOM.cpp:188:6: error: prototype for 'void ArCOM::readInt16Array(short int*, unsigned int)' does not match any in class 'ArCOM'

void ArCOM::readInt16Array(short numArray[], unsigned int nValues) {


In file included from sketch\ArCOM.cpp:22:0:

ArCOM.h:69:8: error: candidate is: void ArCOM::readInt16Array(int16_t*, unsigned int)

  void readInt16Array(int16_t numArray[], unsigned int size);


DIO:60:3: error: 'Serial1' does not name a type



exit status 1
prototype for 'void ArCOM::writeUint16(short unsigned int)' does not match any in class 'ArCOM'

  Control external serial device
Posted by: mikeeconomo - 10-11-2019, 02:13 PM - Forum: Hardware - Replies (1)

I'd like to control an external serial device using a bpod r2.  It seems that within the Matlab API, one can forward serial commands to the Module outputs.  If I understand correctly, SM->Module communication occurs at a baud rate hard-coded in the bpod firmware (1.3 Mb/s). The device I'd like to control uses a different baud rate (115200).  Is there a way to set the SM->Module baud rate through the API?  Or is it better to modify the firmware?  If I do the latter, will that disrupt communication with existing modules (e.g. the analog output module)?  Or can I control the baud rate for each Module output separately?  Perhaps there is a better way to control an external serial device than by using the module outputs?

  Sync camera with Bpod
Posted by: Meowater - 10-08-2019, 09:23 PM - Forum: Software - Replies (1)

Hi Josh and other Bpod users,

I am trying to sync video acquisition with behavioral tasks using Bpod throughout each trial. The camera I am using can capture frames triggered by individual TTL pulses. The following is my questions: 

1.      What is the best way to trigger the camera and have synced timestamps between the camera and the Bpod? 

           a. use Bpod TTL output channel to send pulses to trigger the camera.       
           b. use Analog Output Module to send a waveform.      
           c. use an external device to send TTL pulses to both the Bpod and the camera. The external device would be  triggered by the onset and offset of each trial. 

2.    If one were to use either the Bpod TTL output channel or the Analog Output module, is it possible to send a continuous TTL pulses within each trial that is dependent on the start and the end of the trial? I could be wrong, but my concern of triggering the camera through each state is that the short delay between states might cause jitters in the frame rate, especially when the frame rate is high. 



  Waveform size of 8ch output module
Posted by: Meowater - 10-07-2019, 03:59 PM - Forum: Software - Replies (2)


I am using the 8 channel analog module with Bpod State Machine R2 to control optical stimulation. 
According to the description for Waveplayer, the maximum sample size is 1M. 

However, with the current setup, I get the following error when the waveform size is set to be anything bigger (>) than 499997: 

Quote:Error using serial/fwrite (line 199)
Unsuccessful write: The number of bytes written must be less than or equal to OutputBufferSize-BytesToOutput.

Error in ArCOMObject_Bpod/write (line 293)
                    fwrite(obj.Port, ByteString, 'uint8');

Error in BpodWavePlayer/loadWaveform (line 329)
            obj.Port.write(['L' WaveIndex-1], 'uint8', nSamples, 'uint32', WaveBits, 'uint16');

Error in Airpuff_v4 (line 104)
W.loadWaveform(3, Pulse20Hz');

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

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

Only Ch1 and Ch2 of the output Module are currently in use, and the sampling rate is around 44k. 

The protocol runs as long as the sample size of those waveforms are set to be less than (<=) 499997. 

Do you know what could be causing this issue with the waveform size and how to increase it to reach 1M? Thanks!


  Air puff
Posted by: Bowey - 10-07-2019, 12:38 AM - Forum: Hardware - Replies (2)

Hi Josh,

I wonder if there's a way to deliver air puff via the solenoid valve controlled by Bpod? If so, what will be the parameter fit for this purpose?


  Change sma (e.g. value of global timer) of next trial based on previous trial
Posted by: ziyi - 09-16-2019, 02:44 PM - Forum: Software - Replies (1)

I am hoping to have a global random process that determines when each tone is presented in each trial. Say I have tone timing at 5.6s, 8.4s, 14.9s, etc, and the first trial last for 7s, second last for 5s, then the tone is presented at 5.6s, 1.4s, 2.9s on the first 3 trials. 
Basically I need to change the time of the global timers in each trial based on the duration of the preceding trial, which will be determined by the action of the mice on that trial. Currently, we send the state of next trials into the state machine before we execute this trial, meaning that we can’t change the sma of the next trial after we get the time of this trial (e.g. from the RawEvent variable). So I am wondering:
1. if there is a way to dynamically change the sma (specifically the value of global timers) of the future trial based on the data from the previous trial.
Two additional questions:
2. if there is a way to pause a global timer and pick it up afterwards, instead of triggering and cancelling it
3. is ‘GlobalTimer1_End’ only triggered when the timer just ended, or is it a continuous state (of 0 or 1)
Our current code is below:
sma = PrepareStateMachine(S, TrialTypes, 1, []); % Prepare state machine for trial 1 with empty "current events" variable
TrialManager.startTrial(sma); % Sends & starts running first trial's state machine. A MATLAB timer object updates the
                              % console UI, while code below proceeds in parallel.
% In this case, we don't need trial events to build the state machine - but
% they are available in currentTrialEvents.
%% Main trial loop
for currentTrial = 1:MaxTrials
    currentTrialEvents = TrialManager.getCurrentEvents({'WaitForLick', 'OpenValve'}); % Hangs here until Bpod enters one of the listed trigger states, then returns current trial's states visited + events captured to this point
    if BpodSystem.Status.BeingUsed == 0; return; end % If user hit console "stop" button, end session
    [sma, S] = PrepareStateMachine(S, TrialTypes, currentTrial+1, currentTrialEvents); % Prepare next state machine.
    % Since PrepareStateMachine is a function with a separate workspace, pass any local variables needed to make
    % the state machine as fields of settings struct S e.g. S.learningRate = 0.2.
    SendStateMachine(sma, 'RunASAP'); % With TrialManager, you can send the next trial's state machine while the current trial is ongoing
    RawEvents = TrialManager.getTrialData; % Hangs here until trial is over, then retrieves full trial's raw data
…… etc.
I.e. I want to use ‘RawEvents’ of this trial to change the sma of the next trial.
Please let me know if that is possible.
Thank you very very much
Ziyi Zhu

  TriggerProfiles for 8 channel Analog output module
Posted by: owen - 09-14-2019, 09:27 PM - Forum: Software - Replies (2)

Hello Josh,

1) Based on the wiki, TriggerProfiles must be a 64X4 matrix and the columns are channels. Does that mean I can only control channel #1-4 using triggerprofiles? How to control channel #5-8?
2) Another question is I have two protocols: one play waveforms by generating triggerprofiles while the other one doesn't. After I run the triggerprofile protocol and switch to another one, there's no sound played. I need to unplug/replug the USB power to make it to work again. Is it normal?

Thank you!

  Parallel state machine and global timers
Posted by: ziyi - 09-13-2019, 06:18 PM - Forum: Software - Replies (2)

Hi Josh, I have two questions:

1. Can I have multiple state machines running in parallel? E.g. one state machine controls lick tube, water delivery, and the other state machine controls sound and speakers.

2. For global timers, how do I know how much time has elapsed since that timer is on at a given moment (say the start of a specific state). For each state, how do I know how long that state took from its start to its end.

Thank you very much

Ziyi Zhu

  Compatible Optoisolator for r0.5
Posted by: tanner.stevenson - 09-09-2019, 07:21 PM - Forum: Hardware - Replies (2)

We are looking to build more r0.5 boards but the specified optoisloator component is obsolete. Would this replacement suffice?

  sampling rate for analog module
Posted by: owen - 08-29-2019, 01:42 PM - Forum: Hardware - Replies (1)

On the web page the maximum sampling rate for 4 channel (up to 100k HZ with channel 3 & 4 disabled) and 8 channel version (up to 50k HZ with channel 5-8 disabled) of analog output module is different. I was wondering if this only applies to the current products? We purchased one 8 channel version few years ago and aren't sure if the old 8 channel version can go up to 100k HZ. Thank you!