import argparse
import time
import numpy as np
import mindrove
from mindrove.board_shim import BoardShim, MindRoveInputParams, BoardIds
from mindrove.data_filter import DataFilter, FilterTypes, AggOperations
def main():
BoardShim.enable_dev_board_logger()
parser = argparse.ArgumentParser()
# use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port
parser.add_argument('--timeout', type=int, help='timeout for device discovery or connection', required=False,
default=10)
parser.add_argument('--ip-port', type=int, help='ip port', required=False, default=4210)
parser.add_argument('--ip-protocol', type=int, help='ip protocol, check IpProtocolType enum', required=False,
default=0)
parser.add_argument('--ip-address', type=str, help='ip address', required=False, default='192.168.4.2')
parser.add_argument('--serial-port', type=str, help='serial port', required=False, default='')
parser.add_argument('--mac-address', type=str, help='mac address', required=False, default='')
parser.add_argument('--other-info', type=str, help='other info', required=False, default='')
parser.add_argument('--streamer-params', type=str, help='streamer params', required=False, default='')
parser.add_argument('--serial-number', type=str, help='serial number', required=False, default='')
# parser.add_argument('--board-id', type=int, help='board id, check docs to get a list of supported boards',
# required=True)
# parser.add_argument('0', type=int, required=True)
parser.add_argument('--file', type=str, help='file', required=False, default='')
args = parser.parse_args()
params = MindRoveInputParams()
params.ip_port = args.ip_port
params.serial_port = args.serial_port
params.mac_address = args.mac_address
params.other_info = args.other_info
params.serial_number = args.serial_number
params.ip_address = args.ip_address
params.ip_protocol = args.ip_protocol
params.timeout = args.timeout
params.file = args.file
# board = BoardShim(args.board_id, params)
board_id = BoardIds.MINDROVE_WIFI_BOARD
board = BoardShim(board_id, params)
board.prepare_session()
board.start_stream(45000, args.streamer_params)
for i in range(10):
time.sleep(1)
board.insert_marker(i + 1)
data = board.get_board_data()
board.stop_stream()
board.release_session()
print(data)
if __name__ == "__main__":
main()
Mindrove手环示例--1
于 2024-01-08 17:34:26 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)