Jun-17-2017, 09:59 AM
i ve muse headband and arduino.I want to take datas from muse and give them to arduino for some calculations.
#define libs
from liblo import *
import sys
import time
import serial
import math
#define arduino serial way
ser = serial.Serial('/dev/ttyACM0')
#class
class MuseServer(ServerThread):
#listen for messages on port 5000
def __init__(self):
ServerThread.__init__(self, port=5000)
self.port=5000
self.alpha = 0.0
# take datas from device
@make_method('/muse/acc', 'fff')
def acc_callback(self, path, args):
acc_x, acc_y, acc_z = args
print "%s %f %f %f" % (path, acc_x, acc_y, acc_z)
#connect to device
try:
server = MuseServer()
except ServerError, err:
print str(err)
sys.exit()
server.start()
if __name__ == "__main__":
while 1:
time.sleep(1)
When i run on terminal i see "AttributeError: attribute 'port' of 'liblo._ServerBase' objects is not writable" Error.
I use Python 2.7
#define libs
from liblo import *
import sys
import time
import serial
import math
#define arduino serial way
ser = serial.Serial('/dev/ttyACM0')
#class
class MuseServer(ServerThread):
#listen for messages on port 5000
def __init__(self):
ServerThread.__init__(self, port=5000)
self.port=5000
self.alpha = 0.0
# take datas from device
@make_method('/muse/acc', 'fff')
def acc_callback(self, path, args):
acc_x, acc_y, acc_z = args
print "%s %f %f %f" % (path, acc_x, acc_y, acc_z)
#connect to device
try:
server = MuseServer()
except ServerError, err:
print str(err)
sys.exit()
server.start()
if __name__ == "__main__":
while 1:
time.sleep(1)
When i run on terminal i see "AttributeError: attribute 'port' of 'liblo._ServerBase' objects is not writable" Error.
I use Python 2.7