-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: adding support for multiple emotibits
Signed-off-by: Andrey Parfenov <[email protected]>
- Loading branch information
1 parent
134d538
commit 008e524
Showing
4 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import argparse | ||
import time | ||
|
||
from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds, BrainFlowPresets | ||
from brainflow.data_filter import DataFilter | ||
|
||
|
||
def main(): | ||
BoardShim.enable_dev_board_logger() | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--id1', type=str, help='id for first emotibit', required=True) | ||
parser.add_argument('--id2', type=str, help='id for second emotibit', required=True) | ||
args = parser.parse_args() | ||
|
||
params1 = BrainFlowInputParams() | ||
params1.serial_number = args.id1 | ||
params2 = BrainFlowInputParams() | ||
params2.serial_number = args.id2 | ||
board_id = BoardIds.EMOTIBIT_BOARD.value | ||
|
||
presets = BoardShim.get_board_presets(board_id) | ||
print (presets) | ||
|
||
# Init both boards | ||
board1 = BoardShim(board_id, params1) | ||
board2 = BoardShim(board_id, params2) | ||
board1.prepare_session() | ||
board2.prepare_session() | ||
|
||
# Start streaming for both | ||
board1.start_stream() | ||
board2.start_stream() | ||
time.sleep(10) | ||
|
||
# Get data from both | ||
data_default1 = board1.get_board_data(preset=BrainFlowPresets.DEFAULT_PRESET) | ||
data_aux1 = board1.get_board_data(preset=BrainFlowPresets.AUXILIARY_PRESET) | ||
data_anc1 = board1.get_board_data(preset=BrainFlowPresets.ANCILLARY_PRESET) | ||
data_default2 = board2.get_board_data(preset=BrainFlowPresets.DEFAULT_PRESET) | ||
data_aux2 = board2.get_board_data(preset=BrainFlowPresets.AUXILIARY_PRESET) | ||
data_anc2 = board1.get_board_data(preset=BrainFlowPresets.ANCILLARY_PRESET) | ||
|
||
# Stop streaming for both | ||
board1.stop_stream() | ||
board2.stop_stream() | ||
|
||
# Release both boards | ||
board1.release_session() | ||
board2.release_session() | ||
|
||
# Write data from both | ||
DataFilter.write_file(data_default1, 'default1.csv', 'w') | ||
DataFilter.write_file(data_aux1, 'aux1.csv', 'w') | ||
DataFilter.write_file(data_anc1, 'anc1.csv', 'w') | ||
DataFilter.write_file(data_default2, 'default2.csv', 'w') | ||
DataFilter.write_file(data_aux2, 'aux2.csv', 'w') | ||
DataFilter.write_file(data_anc2, 'anc2.csv', 'w') | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters