[PythonCE] Accessing serial port with PythonCE 2.5

Steve (Gadget) Barnes gadgetsteve at hotmail.com
Tue Dec 15 01:53:00 EST 2015



On 15/12/2015 06:41, Rushali Watane wrote:
> David Goncalves <pythonce-ml <at> lestat.st> writes:
> 
>>
>> Hi,
>>
>> Stefan Johansson wrote:
>>> You can find a link to ceserial in the archives:
>>> http://mail.python.org/pipermail/pythonce/2006-September/001589.html
>>> I have used it successfully on my Dell Axim.
>>
>> Thanks a lot for that link.
>>
>> I downloaded CeSerial and started to listen to my serial port
>> only with 3 lines of code ;)
>>
>> Regards.
>>
> Hi,
> 
> I have also downloaded ceSerial and successfully communicate with serial 
> ports. I have successfully write the data to the port but I am not able 
> to read the data from the ports. It is getting connected to the port but 
> it is not able to read the values. Below is my code snippet for reading 
> the data from the port.
> 
> Can you help me to solve this issue.
> 
> from time import sleep
> import ceserial
> 
> ser = 
> ceserial.Serial(port="COM1:",baudrate=9600,bytesize=8,stopbits=ceserial.
> STOPBITS_ONE,parity=ceserial.PARITY_EVEN)
> 
> print("connected to: " + ser.portstr)
> 
> #data = ''
> while True:
>     data = ser.read(9999)
>     if len(data) > 0:
>         print 'Got:', data
>     sleep(0.5)
>     #print 'not blocked'
> 
> ser.close()
> 
> Regards
> Rushali
> 
> 
> 
> 
> _______________________________________________
> PythonCE mailing list
> PythonCE at python.org
> https://mail.python.org/mailman/listinfo/pythonce
> 

Hi,

You seem to be missing the essential steps of ser.open() before trying
to read and ser.close() at the end.
-- 
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.


More information about the PythonCE mailing list