Exemplo n.º 1
0
    def __init__(self, port="COM7"):
        self.lead_count = 0
        target_port = port
        # target_port = 'devA/tty.XXXXXXX'  #change this to work on OSX

        try:
            self.nskECG = NeuroskyECG(target_port)
        except serial.serialutil.SerialException:
            print("Could not open target serial port: %s" % target_port)
            sys.exit(1)

        # optional call, default is already 1
        self.nskECG.setHRVUpdate(1)  # update hrv every 1 detected pulses

        # want the LEAD_TIMEOUT to hold on to values between baseline and test, but reset between users
        self.LEAD_TIMEOUT = 30  # reset algorithm if leadoff for more than this many seconds
        self.cur_lead_on = False
        self.cur_hrv = 0