Combining color sensors and distance sensors in one code

Hello,

I have a color sensors code, which needs to sample color every 50 milliseconds, in order to work properly and a distance sensors code, that uses PulseIn command, which can easily pass the value of 300 milliseconds, when waiting for the sound signal to return.

How can i mesh these two conflicting demands into a single code?

BTW, the color sensors code already uses all the interrupts pins i have on my Mega…

Thanks!

You want help with your code, yet, you didn’t post it…

A pin change interrupt is available on any port pin.