Two infrared sensors placed a known distance apart turn into a working speed gun: measure how long an object takes to travel between them, and the rest…