NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Reading from the serial port using python?
February 06, 2011 by lcruz007 |
Hello, I am sending some values from the MCU to the serial port using:
Then I want to read that value using a python script. What's the best way to do this task? I tried reading the characters sent by the serial port using Python but it didn't work very well, it was very unstable (the variable wasn't read 100% of the time). This is my python code, what's wrong with it...?
Thank you! |
---|---|
February 07, 2011 by hevans (NerdKits Staff) |
Hi lcruz, The code looks fine from this end. Serial communications are not going to be 100% reliable. You need to have code on the receiving side to interpret the values and just ignore things that don't make any sense. Slowing down the rate at which you send data down the serial port might also help. Humberto |
Please log in to post a reply.
Did you know that NerdKits make a great gift? Learn more...
|