harmsm / PyCmdMessenger

Python interface for CmdMessenger arduino serial communication library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arduino Yun

sphh opened this issue · comments

commented

I developed and tested the CmdMessenger communication on this set-up:
PyCmdMessenger: Linux
CmdMessenger: Arduino Uno
Connection: USB (Serial)
After I got everything working, I transferred the Python program and the sketch to the Arduino Yun:
PyCmdMessenger: Yun
CmdMessenger: microprocessor on the Yun
Connection: Serial, pins 0+1 (Serial1)

Now the CmdMessenger cannot connect to the PyCmdMessenger anymore. Do you have any idea what might go wrong??

Thank you for your help!
Stephan

Hi Stephan,

I've never used a Yun before. Congratulations: you're the first Yun/PyCmdMessenger hardware tester!

Do you have any more information about the problem? What does "cannot connect" mean? Is there an error message thrown?

Some things to check:

  1. Are the port (e.g. /dev/XXX) and baud rate specified correctly for the yun?
  2. Does pyserial work if you use it alone?
# something like this -- not tested as I'm away from my arduino -- but hopefully gives an idea
import serial
s = serial.Serial(port=/dev/XXX,baudrate=9600)
s.write("0;") # would be "who_are_you" from the example in README.md
x = s.read()

Let me know how things turn out -- happy to work with you.

Best,

Mike

commented

Hi Mike,

I'm honoured to be on the cutting edge of Yun/PyCmdMessenger hardware testing!

I was hoping, that you knew which button I have to press to get it working without me going into debugging mode.

With your Python snipplet I can communicate from the Yun/Linux to the Yun/Arduino and vice versa. I noticed that I get a lot of garbage: '\x80' (€) and '\x98' (~) characters in alternating order, but after I read all those characters I can send and receive commands to/from my sketch. So I started my python program, but I have the same problem.

I guess I have to go back to the basics and try the example programs/sketches. This might take some time, because I am away for the rest of the week.

I keep you updated!
Stephan

Sounds like an intriguing problem... Sorry I don't have the push-button solution for you. Feel free to bug me if helpful while you work on it.

Best,

Mike

commented

Hi Mike,

I have not forgotten it, but was short on time. In the meantime I upgraded my Yún to the newest version and nearly bricked it (but that's another story as they say). I uploaded your duplex_test and ran the corresponding Python program on the Yún. It worked, so I willl close this bug.

What does cause the misunderstanding? I have no idea. Only an inkling that I tried to be too clever in my Python program. I wanted to handle a possible un- and subsequent reconnect of the serial cable. That code worked, if a regular Arduino is connected with a USB cable but not in the case of the Yún (BTW it does only make sense there, if the microcontroller is somehow restarted, because the serial connection between those two is soldered ...) I might get rid this part of the code for good.

Stephan