pygame.init() Clock = pygame.time.Clock() try: screen = pygame.display.set_mode((800, 600)) myFont = pygame.font.SysFont("Ubuntu", 20, True) chan_names = [] for s in range(len(counter_to_sensor_id)): chan_names.append(myFont.render(counter_to_sensor_id[s], 1, (0, 0, 0))) while mainloop: # pull existing packets from the EEG pulled = eeg.pull_packets(dev) # wait for remaining time to next frame show tickFPS = Clock.tick(fps) # update window title pygame.display.set_caption("Press Esc to quit. FPS: %.2f PACKETS: %d" % (Clock.get_fps(), pulled)) # erase screen to black screen.fill((255,255,255)) # plot the signals gr_height = 600 // 14 gr_width = 750
from emotiv_device import EmotivDevice from emotiv_data_packet import EmotivDataPacket from signal_buffer import SignalBuffer if __name__ == '__main__': print("Setting up device ...") dev = EmotivDevice('SN20120229000254') print("Starting reader ...") dev.start_reader() rb = SignalBuffer(64, 14) for rbp in range(10): pp = rb.pull_packets(dev) print("Pulled %d packets." % pp) print rb.buffer().shape time.sleep(0.2) print("Stopping reader ...") dev.stop_reader() print("Done.")