2 ser2.receive(timeout), 3 ser2.read(), 4 ser2.sendbyte(byte) – Rainbow Electronics GM862-GPS User Manual
Page 36

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 36 of 100
2.5.2 SER2.receive(timeout)
This command receives a string from serial port ASC1 waiting for it until timeout is expired. Return
value will be the first string received no matter of how long the timeout is. Input parameter timeout is a
Python integer, which is measured in 1/10s, and represents the maximum time of waiting for the string
from the serial port ASC1.
Return value is a Python string which is an empty string if timeout expired without any data received
otherwise is the string containing data received.
Example:
a = SER2.receive(15)
receives a string from serial port ASC1 handling, waiting for it for 1.5 s, assigning return value to a.
2.5.3 SER2.read()
This command receives a string from serial port ASC1 without waiting for it. It has no input parameter.
Return value is a Python string which is an empty string if no data received otherwise is the string
containing data received in the moment when command is activated.
Example:
a = SER2.read()
receives a string from serial port ASC1 handling, assigning return value to a.
NOTE: the buffer available for the SER2.receive(timeout) and SER2.read() commands is 4096 bytes.
2.5.4 SER2.sendbyte(byte)
This command sends a byte to serial port ASC1. Input parameter byte is any Python byte that will be
send to serial port ASC1. It can also be zero.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.
Example:
b = SER2.sendbyte(0x0d)
sends byte 0x0d, that is