harmsm / PyCmdMessenger

Python interface for CmdMessenger arduino serial communication library
MIT License
80 stars 32 forks source link

Unable to Run the Python Code in Windows with PyCmdMessenger #7

Closed kritird closed 8 years ago

kritird commented 8 years ago

I need some help here. I have cloned the library of PyCmdMessenger in my project folder. There are three modules - PyCmdMessenger.py , arduino.py and init.py.

I am using the test example to instantiate the arduino object -

self.arduino = PyCmdMessenger.ArduinoBoard("/dev/ttyACM0",baud_rate=9600)

And while trying to run it gives the error -

Traceback (most recent call last): File "C:\Users\Kriti\Desktop\Projects\Python\Transformer Controller\mainThread.py", line 111, in initialize config.comm.append(Communication()) File "C:\Users\Kriti\Desktop\Projects\Python\Transformer Controller\communication.py", line 8, in init self.arduino = PyCmdMessenger.ArduinoBoard("/dev/ttyACM0",baud_rate=9600) AttributeError: 'module' object has no attribute 'ArduinoBoard'

Could you please let me know what am I missing. I am working in windows platform.

kritird commented 8 years ago

And when I try to run the init.py ... it says (below) . How do I install it in windows?

RESTART: C:\Users\Kriti\Desktop\Projects\Python\Transformer Controllerinit.py Traceback (most recent call last): File "C:\Users\Kriti\Desktop\Projects\Python\Transformer Controllerinit.py", line 10, in from .PyCmdMessenger import CmdMessenger as CmdMessenger SystemError: Parent module '' not loaded, cannot perform relative import

harmsm commented 8 years ago

I appreciate your interest in PyCmdMessenger. I don't have a windows box handy, so you're on the bleeding edge of windows testing. Were you able to figure this out? If not, I'm happy to work with you on it. (I'm overseas at the moment and just got to email.)

kritird commented 8 years ago

Hi Mike,

Thanks a ton for response. I did figure it out. The problem was in installation. I did not install your package under python. Later I could install it and use it. I am yet to test with a real arduino. Thanks again for your response.

I will use this thread to let you know about my success/failures :)

Thanks Kriti

On Tue, Jul 12, 2016 at 1:29 PM, Mike Harms notifications@github.com wrote:

I appreciate your interest in PyCmdMessenger. I don't have a windows box handy, so you're on the bleeding edge of windows testing. Were you able to figure this out? If not, I'm happy to work with you on it. (I'm overseas at the moment and just got to email.)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/harmsm/PyCmdMessenger/issues/7#issuecomment-231941067, or mute the thread https://github.com/notifications/unsubscribe/AJk9-rr91y9Ga4I9Vsa8E_xDz0jL3-5gks5qUyZFgaJpZM4JI95T .

harmsm commented 8 years ago

Good news! Glad to know you got it work. Please let me know if anything else comes up.

Mike

kritird commented 8 years ago

Hi Mike,

I would like to inform that the code worked perfectly fine. However I have two queries:

  1. How to handle c.receive() timeouts? can i check a class variable and decide to break from loop on timeout? any help?
  2. How to increase the baud rate above 9600? Just changing the constructor variable baud _rate is causing bad data

Let me at your convenience. Thanks again

On 12 Jul 2016, at 2:36 PM, Mike Harms notifications@github.com wrote:

Good news! Glad to know you got it work. Please let me know if anything else comes up.

Mike

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

harmsm commented 8 years ago

Hi Kriti,

  1. Can you clarify what you mean by "handle"? You set the timeout in the ArduinoBoard constructor. Do you want to change later?
  2. Have you changed the baud rate in the arduino sketch as well? They have to match and can't be higher than the maximum baud rate for your board.

Best,

Mike

kritird commented 8 years ago

Hi Mike,

Yes, I would like to change the timeout value and found that a 'None' return from your code sounds that we have hit a timeout. Working on handling this.

The arduino Uno has max of 115200 (https://www.arduino.cc/en/Serial/Begin) .... I have changed the baud rate in both python and arduino sketch....I willl try again later today and let you know.

Thanks again for your support.

Thanks Kriti

On Wed, Jul 13, 2016 at 4:37 AM, Mike Harms notifications@github.com wrote:

Hi Kriti,

  1. Can you clarify what you mean by "handle"? You set the timeout in the ArduinoBoard constructor. Do you want to change later?
  2. Have you changed the baud rate in the arduino sketch as well? They have to match and can't be higher than the maximum baud rate for your board.

Best,

Mike

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/harmsm/PyCmdMessenger/issues/7#issuecomment-232172700, or mute the thread https://github.com/notifications/unsubscribe/AJk9-nTX6rauTnE65PIO2mxuTxTVq7-cks5qU_sJgaJpZM4JI95T .

kritird commented 8 years ago

Thanks a ton Mike!

The pyCmdMessenger worked at 1Mbps :) Done

On 13 Jul 2016, at 4:37 AM, Mike Harms notifications@github.com wrote:

Hi Kriti,

Can you clarify what you mean by "handle"? You set the timeout in the ArduinoBoard constructor. Do you want to change later? Have you changed the baud rate in the arduino sketch as well? They have to match and can't be higher than the maximum baud rate for your board. Best,

Mike

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

harmsm commented 8 years ago

Great. Glad it works for you. I'm going to close issue. Feel free to reach out if anything else comes up.

Mike