count and send pulses simultaneously

crosspost: https://forum.arduino.cc/index.php?topic=547718.msg3733727#msg3733727