Ubuntu 12.04 using serial port with python 2.7
Using the Serial Terminal Program, with the same port, I can send data to the micro and it works as expected. But, when attempting to use a Python script and pyserial module, no data is
transmitted to the micro. This verified using a scope on the micro's receive data RS-232 line. Using the
Serial Teminal Program, the micro displays the correct information and also is observed at the receive data line as just mentioned.
I can not figure out what else must be done to allow data to be transmitted using the python script.
The script is based on example(s) from different online searches and the pyserial web site.
I am using Ubuntu 12.04 and python 2.73.
#!/usr/bin/bin/env/ python
import serial
import os
ser = serial.Serial('/dev/ttyUSB0',9600, timeout =1)
ser.open()
print ser.portstr # check which port was really used
#### ser.portstr prints /dev/ttyUSB0 ####
s="1234\n"
#Note: neither ser.write sends data to module.
ser.write("1234\n") # write a string
ser.close() # close port
""" Note: I have a micro based external hardware module that displays numerical data received
at the external device serial port. It test excellent using a serial term program. I would have thought this would be a simple write ?
"""
I tried to use the ICONS in the posting menu but they don't respond .
Last edited by anchorman; 08-24-2014 at 02:19 PM.
Reason: attemting to add code tags, didn't work ????
|