I'm trying to send and receive messages between two Linux running laptops via serial communication using Python. The receiver system must see the message "waiting for the message" until it receives the message from the sender. I was searching for sample code to test this. The sample code I have for the sender is as follows:
import serial
com = serial.Serial('/dev/ttyUSB0',baudrate=115200)
com.write('2')
com.close()
But I cannot figure out what to put for the receiver code, where it will display a message on the receivers display as "waiting" and once the message is received it should display "received".
Does anyone have a sample code to work this out?