The main program (TT3.py) creates an instance of traffic.Traffic() to establish connections to the Laptop (WiFi) and Arduino (serial USB). The Traffic class monitors both the Laptop and Arduino for incoming communications. Traffic() uses Command.check() to determine whether communications from the Laptop should be processed by the RPi or the Arduino or both. Traffic() passes the size of any communications to class Monitor to blink LEDs reflecting traffic density.


Traffic from the Arduino is pass directly to the laptop. 


By design the Traffic class only "knows" that commands from the Laptop and responses from the Arduino end with a ">". 


In the traffic module

Traffic class