Hi,
I have been having a problem using the analog input module. When I call the 'BpodAnalogin' function in MATLAB, there is an error message:
>> A = BpodAnalogIn("/dev/cu.usbmodem71558201")
Error in function OpenSerialPort: Incorrect argument type supplied
Discrepancy between a specified and supplied argument:
Specified Argument Description:
direction: Input
position: 1
presence:
formats allowed:
char
minimum M: 0
maximum M: unbounded
minimum N: 0
maximum N: unbounded
minimum P: 0
maximum P: 1
Provided Argument Description:
direction: Input
position: 1
presence: present
format:unclassified
number of dimensions: 2
M: 1
N: 1
P: 1
Error in function Close: Missing argument
Discrepancy between a specified and supplied argument:
Specified Argument Description:
direction: Input
position: 1
presence:
formats allowed:
double
minimum M: 1
maximum M: 1
minimum N: 1
maximum N: 1
minimum P: 1
maximum P: 1
Provided Argument Description:
direction: Input
position: 1
presence: absent
Error using BpodAnalogIn (line 74)
Error: unable to connect to Bpod Analog Input module.
However, I can see from BpodSystem.modules that the analog input module is connected and I have specified the correct port name in the function:
>> BpodSystem.Modules
ans =
struct with fields:
nModules: 5
RelayActive: [0 0 0 0 0]
Connected: [1 0 0 0 0]
Name: {'AnalogIn1' 'Serial2' 'Serial3' 'Serial4' 'Serial5'}
Module2SM_BaudRate: [1312500 1312500 1312500 1312500 1312500]
FirmwareVersion: [2 0 0 0 0]
nSerialEvents: [15 15 15 15 15]
EventNames: {[] [] [] [] []}
USBport: {'/dev/cu.usbmodem71558201' [] [] [] []}
One thing I have noticed is that the baud rate of the port from BpodSystem.modules is 1312500. However, when I look into the MATLAB script of the 'BpodAnalogIn' function and the associated 'ArCOMObject_Ain' function, it seems like they assume the baud rate to be 115200. Therefore, I tried to change the baud rate on these 2 scripts to 1312500 and call the function again. Unfortunately, the error still occurs.
How can I get the analog input module working? FYI, I am using a Mac.
Many thanks,
Tin