-
Notifications
You must be signed in to change notification settings - Fork 29
/
eegBCI.py
39 lines (32 loc) · 1.28 KB
/
eegBCI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# eegBCI.py
#
# Runs two scripts to receive EEG data from a microcontroller and
# to control a keyboard using the EEG data. A pipe is created to
# share data between the two scripts.
# Author: Ronan Byrne
# Last Updated: 09/05/2018
#
import multiprocessing
import numpy as np
import eegInterface
import eegScope
if __name__ == '__main__':
# Interface arguments
window_size = [1200, 700]
checker_cycles = 4 # Number of times texture repeats in box
checker_size = 160
checker_tex = np.array([[1, -1], [-1, 1]]) # One black and one white box
checker_frequency = np.array([10, 20, 15, 5, 12]) # Flashing Frequencies
# Serial port
port = '/dev/ttyUSB0'
# Creating a pipe
parent_conn, child_conn = multiprocessing.Pipe()
# Create processes for user interface and scope
interface_pro = multiprocessing.Process(target=eegInterface.BCI, args=(window_size, checker_frequency,
checker_size, checker_cycles, checker_tex, child_conn))
graphing_pro = multiprocessing.Process(target=eegScope.Scope, args=(port, parent_conn))
interface_pro.start()
graphing_pro.start()
# Close the processes before finishing
interface_pro.join()
graphing_pro.join()