Added timeout for receiving UDP signals.

- also removed hardcoded reference for pins_arduino.h
- cleaned up code for submission
Fixed bug where uart buffer is flushed at wrong time