The main program should create an instance of traffic.Traffic() to establish connections to the Laptop and Arduino. To watch for command from the laptop call read_LT() and check the returned string.
In response to a command or to report a change in status, responses are passed to write_LT().
In the traffic module
- Reads a string from the Arduino
and passes it to write_LT()
- Reads a string from the laptop ending with ">"
If the command is intended for the Arduino
it is passed directly to write_BS() and a "" is returned
If the command is intended for the Raspberry Pi
it is returned
- write_BS(self, message)
- Writes to the Arduino the string passed
as a parameter from read_LT()
then calls read_BS() and waits for a reply.
Arg: string to be sent