Brainflow change serial port from Windows to Mac

edited May 31 in Cyton

Hi Everyone,
Hope all is well
I am working on EEG using OpenBCi cap and am streaming the code with Python, and also checking the signal with Openbci Gui,
The code for streaming is as follows:
The question is how can I access the serial port in MAC to replace it with Com 3, Python, bc this code is working on Windows properly, but now I am switching to MacBook M series

BoardShim.enable_dev_board_logger()
# use synthetic board for demo
params = BrainFlowInputParams()
params.serial_port = "COM3"
board = BoardShim(2, params)
board.prepare_session()
board.start_stream()
time.sleep(35)
data = board.get_board_data()
board.stop_stream()
board.release_session()
eeg_channels = BoardShim.get_eeg_channels(2)
eeg_data = data[eeg_channels, :]
eeg_data = eeg_data / 1000000  # BrainFlow returns uV, convert to V for MNE
# Creating MNE objects from brainflow data arrays
ch_types = ['eeg'] * len(eeg_channels)
ch_names = BoardShim.get_eeg_names(BoardIds.SYNTHETIC_BOARD.value)
sfreq = BoardShim.get_sampling_rate(2)
info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)
raw = mne.io.RawArray(eeg_data, info)
raw.crop(tmin=3,tmax=30)

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Hi Sorous,

    Mac is based on Unix, which lists serial ports in the /dev directory. If you remove the dongle, then do a directory listing (using the Mac 'Terminal' app): ls -l /dev, then insert the dongle and do another listing, you should see that a new entry shows up which corresponds to the dongle.

    William

Sign In or Register to comment.