Unable to obtain data using OpenBCIWiFi / OpenBCI_Python

JayroMartinezJayroMartinez Tübingen, Germany
edited May 2019 in Software
Hello everyone,

This is my first post here so I want to apologize if is not the correct place for this. I'm completely new using OpenBCI and also Python, so I'm sure I'm making a mistake somewhere.

I'm trying to get data from my Cyton+Daisy via WiFi shield using the code in OpenBCI_Python over my Mac laptop. I wrote a very simple code as is shown below. This code is giving me some information but after that it gets stuck when I call start_streaming() and shows no data. 

from openbci import OpenBCIWiFi
import requests
import asyncore

def handle_streamed_data(sample):
print(sample.sample_number)
print(sample.channel_data)

if __name__ == '__main__':

ip_address = '192.168.4.1'
shield_name = 'OpenBCI-79AB'
sample_rate = 500
log = True
timeout = 5
max_packets_to_skip = 10
latency = 5000
high_speed = False
ssdp_attempts = 10

connection = OpenBCIWiFi(ip_address=ip_address,
   shield_name=shield_name,
   sample_rate=sample_rate,
   log=log,
   timeout=timeout,
   max_packets_to_skip=max_packets_to_skip,
   latency=latency,
   high_speed=high_speed,
   ssdp_attempts=ssdp_attempts)
#connection.connect()

print "Ip de la conexio:", connection.ip_address, "\n"

res_command_post = requests.get("http://%s/all" % connection.ip_address)
ieison = res_command_post.json()

print "Status", res_command_post.status_code, "\n"
print "Text", ieison

print "Pre-streaming"
connection.start_streaming(handle_streamed_data)
print "Post-streaming"

connection.loop()

#connection.disconnect()


What I get when run the code is:






Welcome to OpenBCI Native WiFi Shield Driver - Please contribute code!

Opened socket on 172.16.162.72:57461

Init WiFi connection with IP: 192.168.4.1

Connected to daisy with 16 channels

Ip de la conexio: 192.168.4.1 


Status 200 


Text {u'latency': 5000, u'name': u'OpenBCI-79AB', u'ip': u'0.0.0.0', u'version': u'v2.0.5', u'mac': u'82:7D:3A:3F:79:AB', u'num_channels': 16, u'heap': 18824, u'board_connected': True}

Pre-streaming

Post-streaming


Does anyone knows what is happening? Also, is there any tutorial/example code/documentation about this? Because the information that I've seen is not helpful for me. 

Thanks.


Comments

Sign In or Register to comment.