()
| 6 | |
| 7 | |
| 8 | def main(): |
| 9 | parser = argparse.ArgumentParser() |
| 10 | # use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port |
| 11 | parser.add_argument('--ip-port', type=int, help='ip port', required=False, default=0) |
| 12 | parser.add_argument('--ip-protocol', type=int, help='ip protocol, check IpProtocolType enum', required=False, |
| 13 | default=0) |
| 14 | parser.add_argument('--ip-address', type=str, help='ip address', required=False, default='') |
| 15 | parser.add_argument('--serial-port', type=str, help='serial port', required=False, default='') |
| 16 | parser.add_argument('--mac-address', type=str, help='mac address', required=False, default='') |
| 17 | parser.add_argument('--other-info', type=str, help='other info', required=False, default='') |
| 18 | parser.add_argument('--board-id', type=int, help='board id, check docs to get a list of supported boards', |
| 19 | required=True) |
| 20 | parser.add_argument('--log', action='store_true') |
| 21 | args = parser.parse_args() |
| 22 | |
| 23 | params = BrainFlowInputParams() |
| 24 | params.ip_port = args.ip_port |
| 25 | params.serial_port = args.serial_port |
| 26 | params.mac_address = args.mac_address |
| 27 | params.other_info = args.other_info |
| 28 | params.ip_address = args.ip_address |
| 29 | params.ip_protocol = args.ip_protocol |
| 30 | |
| 31 | if (args.log): |
| 32 | BoardShim.enable_dev_board_logger() |
| 33 | else: |
| 34 | BoardShim.disable_board_logger() |
| 35 | |
| 36 | board = BoardShim(args.board_id, params) |
| 37 | board.prepare_session() |
| 38 | |
| 39 | # disable 2nd channel for cyton use real board to check it, emulator ignores commands |
| 40 | if args.board_id == brainflow.board_shim.BoardIds.CYTON_BOARD.value: |
| 41 | board.config_board('x2100000X') |
| 42 | |
| 43 | board.start_stream() |
| 44 | time.sleep(10) |
| 45 | data = board.get_board_data() |
| 46 | board.stop_stream() |
| 47 | board.release_session() |
| 48 | |
| 49 | print(data) |
| 50 | |
| 51 | |
| 52 | if __name__ == "__main__": |
no test coverage detected