Skip to content
13 changes: 12 additions & 1 deletion boardStreamer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from find_cyton import find_cyton
from brainflow.board_shim import BoardShim, BoardIds, BrainFlowInputParams
from time import sleep
import socket
import pickle

from functools import cached_property

Expand Down Expand Up @@ -96,7 +98,16 @@ def get_data(self) -> list:

board = CytonBoard(**args)

# setup socket connection
host = socket.gethostname()
""" Starting a TCP socket. """
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
""" Connecting to the server. """
client_socket.connect((host, args['port']))

while True:
data = board.get_data()

client_socket.send(pickle.dumps(data))

# insert socket code here