Let me see if I understand your issue. You can see the data in the Linux part by using the cat command and in python with the pyserial command ser.read() , but you are not seeing the data of the serial port in the serial monitor of the command line, is this correct?
Basically I followed those 2 pages I listed before - Trying to use PySerial to drive a serial lcd (parallax)? - this one provides the following python code that I used:
ser = serial.Serial(“/dev/ttyS0”, 57600)
ser = serial.Serial(“/dev/ttyGS0”, 9600)
for i in range(10): #I added these 2 lines
I just added a loop for it to listen to a certain number of requests. I could send data from the serial monitor in the IDE and it would display in python. So the /dev/ttyS0 port could be monitored in this way. I am trying to write data from sensors to the /dev/ttyS0 UART from the sketch - and I tried serial.print(data); and serial1.print(data) and serial2.print(data) but I never receive any data from the ser.read() in pyserial.
I hope that makes sense - thanks for the quick response.
Well the commands ser = serial.Serial(“/dev/ttyS0,57600) and ser = serial.Serial(“/dev/ttyGS0”, 9600) are used to initialize the ports. The ttyS0 is the pin 0 and 1 used as serial port and the GS0 is the USB client, in case you want to use both, you’ll have to change the name one the variables from “ser” to another name, because if you use the code like you posted, you would use as ser the USB client not the serial port. Also remember to change the speeds depending on the speed the sensor sends the data, for example for the ttyS0 maybe your sensor sends data at 9600 bauds you just have to change the 57600 for 9600. To read a line of data you can use line = ser.readline(). I recommend you to check this post in there is an introduction to pyserial. http://pyserial.sourceforge.net/shortintro.html it might be useful.
Thanks - I was just following the code posted on the second page I listed. I wondered why they would declare a variable that pointed to 2 different ports. I tried it using different variable names polling different ports but it didn't work either. I know pyserial fairly well so I checked all the port speeds and things like that but I still can't get data through the ttyS0 port. I guess I will give up for a while - I tried every permutation that I could think of but never got any data. I gave up this morning and connected a mega instead of a Galileo and everything works well so I'll just stick with that. It is kind of disappointing though as seems that it should work.