The example below shows how to use the serial_connection module send commands and receive response from a device.
# Import serial connection class. from serial_connection import SerialConnection if __name__ == "__main__": # Create the serial port connection object with default settings. serial = SerialConnection("R246744") # Get device name and friendly description. print(serial.name) print(serial.description) # Open connection. serial.open() # Send command. serial.send(b"info") # Get response. response = serial.receive() # Print response in binary format. print(response) # Close connection. serial.close()