Interactive Arduino pong game

Hey soooo I’m trying to make an interactive pong game with arduino. Basically, I am using an infrared emitter and receiver to detect when an object is over them, and moving your hand will move the pong paddle left or right. I am using a TLC5940 with 16 leds. What I need to figure out how to code is how to make the " pong ball " roll down the leds toward the paddle WHILE the Infrared receiver is constantly reading for data. So here is the code to make the " ball " move towards the paddle

Tlc.clear();
  
  Tlc.set(14,3000);
  delay(300);
  Tlc.update();
  Tlc.set(14,0);
  Tlc.set(11,3000);
  delay(300);
  Tlc.update();
  Tlc.set(11,0);
  Tlc.set(8,3000);
  delay(300);
  Tlc.update();
  Tlc.set(8,0);
  Tlc.set(5,3000);
  delay(300);
  Tlc.update();
  Tlc.set(5,0);
  Tlc.set(2,3000);
  delay(300);
  Tlc.update();
  Tlc.set(2,0);
  delay(300);
  Tlc.update();

and While this is going on, I need to have analogRead(A5) constantly taking in data, but I am unsure of how to do this. So… after a measured amount of time, if your hand is over the correct " paddle - IR Receiver" , the ball will go back to where it came from and come back towards the paddle. Here is the code for the IR Receiver …

int Receiver = analogRead(A5);
  
    if (Receiver < (Threshold - 7))
..... make the ball go back
else
start level over or whatever.

These things work perfectly independently, but how can I make them run at the same time??

Use Blink without delay example. Basically, you can start each event at a noted time, next pass thru the loop see of the duration you want has elapsed and go from there. Then you can be checking lots of things each pass thru loop.

OK thanks I’ll give it a shot and post back soon

I did the same for scoring machine.
I checked for 1 of 16 RF commands coming in , I checked time and made updates at 1/4 second intervals (3 out of 4 were just turning colon on/off, but SPI updates were the same either way), I checked for scores being made.
It works well. Your stuff occurs a little slower even, should work well for you.

Ok this worked but is there any way I can do it with a TLC5940 instead of a digital Pin... Tlc.set(pin,value)...?

Not sure what you are askng??

Nevermind I think I figured it out

Do you see how this:

Tlc.set(14,3000);
  delay(300);
  Tlc.update();
  Tlc.set(14,0);

looks a lot like this

  Tlc.set(11,3000);
  delay(300);
  Tlc.update();
  Tlc.set(11,0);

and this:

Tlc.set(8,3000);
  delay(300);
  Tlc.update();
  Tlc.set(8,0);

??

That just screams “array” and “for” loop.