Skip to content

Commit c6b3b6a

Browse files
committed
Header of csv file now update according to the num_channels
1 parent a5c084c commit c6b3b6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chords.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def read_arduino_data(ser, csv_writer=None, inverted=False):
170170
total_packet_count += 1 # Increment total packet count for the current second
171171
cumulative_packet_count += 1 # Increment cumulative packet count for the last 10 minutes
172172

173-
# Extract channel data (6 channels, 2 bytes per channel)
173+
# Extract channel data (num_channels, 2 bytes per channel)
174174
channel_data = []
175175
for channel in range(num_channels): # Loop through channel data bytes
176176
high_byte = packet[2*channel + HEADER_LENGTH]
@@ -254,7 +254,7 @@ def parse_data(ser, lsl_flag=False, csv_flag=False, verbose=False, run_time=None
254254
csv_writer.writerow([f"Arduino Board: {board}"])
255255
csv_writer.writerow([f"Sampling Rate (samples per second): {supported_boards[board]['sampling_rate']}"])
256256
csv_writer.writerow([]) # Blank row for separation
257-
csv_writer.writerow(['Counter', 'Channel1', 'Channel2', 'Channel3', 'Channel4', 'Channel5', 'Channel6']) # Write header
257+
csv_writer.writerow(['Counter'] + [f'Channel{i+1}' for i in range(num_channels)]) # Write header
258258

259259
end_time = time.time() + run_time if run_time else None
260260
send_command(ser, 'START')

0 commit comments

Comments
 (0)