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

Traffic class

  • read_BS(self)
  • Reads a string from the Arduino
    and passes it to write_LT()
  • read_LT(self)
  • 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
  • write_LT(self, message)
  • Writes to the Laptop the string passed as a parameter.
    Arg: string to be sent