You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def start_stream(self, buffer_size: int = 450000):
57
-
"""Start the data stream from the board."""
58
-
self.board_shim.prepare_session()
59
-
self.board_shim.start_stream(buffer_size)
60
-
print("Stream started.")
61
-
time.sleep(2)
62
-
for x in range(1, self.num_channels + 1):
63
-
time.sleep(0.5)
64
-
cmd = f"chon_{x}_12"
65
-
self.board_shim.config_board(cmd)
66
-
print(f"sending {cmd}")
67
-
time.sleep(1)
68
-
rld = f"rldadd_{x}"
69
-
self.board_shim.config_board(rld)
70
-
print(f"sending {rld}")
71
-
time.sleep(0.5)
72
-
73
-
def stop_stream(self):
74
-
"""Stop the data stream and release resources."""
75
-
self.board_shim.stop_stream()
76
-
self.board_shim.release_session()
77
-
print("Stream stopped and session released.")
78
-
79
-
Knight_board = KnightBoard("COM3", 8)
80
-
Knight_board.start_stream()
81
-
82
-
while True:
83
-
data = Knight_board.board_shim.get_board_data()
84
-
# do stuff with data
85
-
86
-
if keyboard.is_pressed('q'):
87
-
Knight_board.stop_stream()
88
-
break
89
-
```
90
-
### BrainFlow Configuration Commands
91
-
92
-
To configure the NeuroPawn Knight board with BrainFlow, pass the commands as strings into:
93
-
94
-
board_shim.config_board(<command>)
95
-
96
-
#### Command 1: Enable EEG Channel / Set Gain
97
-
**Purpose**: Enables a specified channel with a specified gain, starting data acquisition on that channel. If the channel is already enabled, it will remain enabled, but will still update its gain.
98
-
99
-
f"chon_{channel}_{gain_value}"
100
-
101
-
##### Parameters:
102
-
103
-
- channel: The channel number to start the data acquisition. Replace this with the actual number of the channel you want to configure. One-indexed.
104
-
105
-
- gain: Specifies the gain value for the channel to be enabled. Allowable gain values are: [1, 2, 3, 4, 6, 8, 12 (recommended)]. The gain value controls the amplification level of the EEG signal on the specified channel.
106
-
107
-
#### Command 2: Disable EEG Channel
108
-
**Purpose**: Disables a specified channel, stopping data acquisition on that channel.
109
-
110
-
f"choff_{channel_number}"
111
-
112
-
##### Parameters:
113
-
114
-
- channel_number: The channel number to **stop** the data acquisition. This is appended to *'choff'* to construct the configuration command. One-indexed.
115
-
116
-
#### Command 3: Toggle on RLD
117
-
**Purpose**: Toogle **on** right leg drive for the specified channel.
118
-
119
-
f"rldadd_{channel_number}"
120
-
121
-
##### Parameters:
122
-
123
-
- channel_number: The channel number to toggle **on** the right leg drive. This number is converted to a string and appended to *'rldadd'* to create the configuration command. One-indexed.
124
-
125
-
126
-
### Command 4: Toggle off RLD
127
-
**Purpose**: Toogle **off** right leg drive for the specified channel.
128
-
129
-
f"rldremove_{channel}"
130
-
131
-
#### Parameters:
132
-
133
-
- channel_number: The channel number to toggle **off** the right leg drive. This number is converted to a string and appended to *'rldremove'* to create the configuration command. One-indexed.
134
-
135
34
## Resources
136
35
137
36
*[***BrainFlow Docs, Dev and User guides and other information***](https://brainflow.readthedocs.io)
0 commit comments