Page 1 of 1

Serial Communication Pyserial

Posted: Mon Jun 02, 2014 4:47 am
by rams4pi
hi friends,
i am facing some problems with serial communcation, my requirement is i need to write i value, Instead of Giving string in ser.write ()

import serial
i = 10
ser = serial.Serial(port, 9600, timeout=1)
ser.open() # i am opening a serial port .
i need to write i value. can any one tell me the syntax .
ser.write(i) # is this correct ... can i write i value using i ...


Please Reply me ASAP

Thanks,
Rams4pi.

Re: Serial Communication Pyserial

Posted: Mon Jun 02, 2014 6:10 am
by riklaunim
Maybe chr(i) would work for you? Serial communication may depend a lot on the target device and its API. If that doesn't help post some info about your device connected via serial.

Re: Serial Communication Pyserial

Posted: Mon Jun 02, 2014 6:11 am
by atomic3

Re: Serial Communication Pyserial

Posted: Mon Jun 02, 2014 7:00 am
by rams4pi
i am coonecting Xbee to Piusing usb and using Pyserial to communicate Serially ..

Re: Serial Communication Pyserial

Posted: Mon Jun 02, 2014 5:17 pm
by atomic3
On the receiving end just convert to int?

Re: Serial Communication Pyserial

Posted: Wed Jun 04, 2014 5:39 am
by rams4pi
Thanks i got the Output ...