()
| 5 | |
| 6 | |
| 7 | def main(): |
| 8 | BoardShim.enable_dev_board_logger() |
| 9 | |
| 10 | parser = argparse.ArgumentParser() |
| 11 | # use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port |
| 12 | parser.add_argument('--timeout', type=int, help='timeout for device discovery or connection', required=False, |
| 13 | default=0) |
| 14 | parser.add_argument('--ip-port', type=int, help='ip port', required=False, default=0) |
| 15 | parser.add_argument('--ip-protocol', type=int, help='ip protocol, check IpProtocolType enum', required=False, |
| 16 | default=0) |
| 17 | parser.add_argument('--ip-address', type=str, help='ip address', required=False, default='') |
| 18 | parser.add_argument('--serial-port', type=str, help='serial port', required=False, default='') |
| 19 | parser.add_argument('--mac-address', type=str, help='mac address', required=False, default='') |
| 20 | parser.add_argument('--other-info', type=str, help='other info', required=False, default='') |
| 21 | parser.add_argument('--serial-number', type=str, help='serial number', required=False, default='') |
| 22 | parser.add_argument('--board-id', type=int, help='board id, check docs to get a list of supported boards', |
| 23 | required=True) |
| 24 | parser.add_argument('--file', type=str, help='file', required=False, default='') |
| 25 | parser.add_argument('--master-board', type=int, help='master board id for streaming and playback boards', |
| 26 | required=False, default=BoardIds.NO_BOARD) |
| 27 | args = parser.parse_args() |
| 28 | |
| 29 | params = BrainFlowInputParams() |
| 30 | params.ip_port = args.ip_port |
| 31 | params.serial_port = args.serial_port |
| 32 | params.mac_address = args.mac_address |
| 33 | params.other_info = args.other_info |
| 34 | params.serial_number = args.serial_number |
| 35 | params.ip_address = args.ip_address |
| 36 | params.ip_protocol = args.ip_protocol |
| 37 | params.timeout = args.timeout |
| 38 | params.file = args.file |
| 39 | params.master_board = args.master_board |
| 40 | |
| 41 | board = BoardShim(args.board_id, params) |
| 42 | board.prepare_session() |
| 43 | board.add_streamer("file://data.csv:w") |
| 44 | board.start_stream() |
| 45 | time.sleep(10) |
| 46 | # data = board.get_current_board_data (256) # get latest 256 packages or less, doesnt remove them from internal buffer |
| 47 | data = board.get_board_data() # get all data and remove it from internal buffer |
| 48 | board.stop_stream() |
| 49 | board.release_session() |
| 50 | |
| 51 | print(data) |
| 52 | |
| 53 | |
| 54 | if __name__ == "__main__": |
no test coverage detected