Describe a time you had to write software or logic to control a physical system. How did you handle latency and real-time constraints?