thiagomarzagao / ev3py

This Python module lets you interact with LEGO Mindstorms EV3 bricks using intuitive, easy-to-understand methods.
MIT License
23 stars 6 forks source link

Does the script run in MacOS? #2

Open jabrena opened 9 years ago

thiagomarzagao commented 9 years ago

It should - I developed it on my MacBook.

jabrena commented 9 years ago

I am trying to run the script, but I receive the following output:

/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 /Users/jabrena/Documents/DATA/2014/RESEARCH/robotics/python/ev3py/demo.py
Traceback (most recent call last):
  File "/Users/jabrena/Documents/DATA/2014/RESEARCH/robotics/python/ev3py/demo.py", line 6, in <module>
    mybrick.connect('bt') # connect with EV3 via Bluetooth
  File "/Users/jabrena/Documents/DATA/2014/RESEARCH/robotics/python/ev3py/ev3py.py", line 156, in connect
    self.brick = open(conn_types[conn_type], mode = 'w+', buffering = 0)
IOError: [Errno 13] Permission denied: '/dev/tty.EV3-SerialPort'

Process finished with exit code 1

I have a Mac 10.10.2

Can you help me?

I would like to test your project.

thiagomarzagao commented 9 years ago

Thanks for the alert, Juan. I'm traveling right now, without my brick, so I won't be able to look into it until next week. I'm guessing that maybe the last OS X update broke things. A less likely possibility is some issue with the Python version - I used Python 2.7 to write the script (sorry, I should have mentioned it somewhere) and I see you're using Python 2.6. Anyway, I'll look into the matter next week.

jabrena commented 9 years ago

No problem Thiago, I will try to update my python support in local. Besides, I will try to get more info on internet. With the EV3 environment, I can connect by Bluetooth without any problem.

I will try to research a bit this week.

Cheers

Juan Antonio

jabrena commented 9 years ago

Hi Thiago,

in the code you have this idea to play a tone:

    # set message size, message counter, command type, vars        
    comm_0 = '\x0F\x00\x00\x00\x80\x00\x00'

    # opSOUND
    comm_1 = '\x94' + LC0(1) + LC1(volume) + LC2(frequency) \
             + LC2(duration)        

    # assemble command and send to EV3
    command = comm_0 + comm_1

If I have to convert this idea to an array:

[0x06, 0x00, 0x00, 0x03, 0x0B, 0x02, 0xF4, 0x01]

What is the conversion for this array:

comm_0 = '\x0F\x00\x00\x00\x80\x00\x00'

and the second one:

comm_1 = '\x94' + LC0(1) + LC1(volume) + LC2(frequency) \

thiagomarzagao commented 9 years ago

I'm getting an error as well (though a different one):

>>> mybrick.connect('bt')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ev3py.py", line 156, in connect
    self.brick = open(conn_types[conn_type], mode = 'w+', buffering = 0)
IOError: [Errno 16] Resource busy: '/dev/tty.EV3-SerialPort'
thiagomarzagao commented 9 years ago

I'm on OS X 10.10.2 and Python 2.7.9.

I'll look into the matter.

thiagomarzagao commented 9 years ago

Wait, no: it was just that the bluetooth adapter on my Mac was off. Now everything works fine.

I see you get a 'permission denied'. Have you tried changing the ownership of the /dev/tty.EV3-SerialPort file?

thiagomarzagao commented 9 years ago

About your array question, I'm not sure I understand what you're trying to convert. Is that array a sound command?