I want to install the same code which does exactly the same thing, but with different sensors
sorry i forgot each Sensor needs two PWM for lighting, BLUE and RED..
told the solution in reply #2.
I'm not seeing where the 2nd Mega comes in, since Mega #1 has a sh!t load of pins, but that might be because you haven't shown yet how all the pins on the 1st one are deployed.
Options for the OP question:1. Run both inputs into a 74xx OR gate
wander off on some tangent rather than answer the question.
Pin count means nothing if they can't do what you need. Based on the detail provided, the OP needs 14 analog inputs
3. Connect Mega 2 to Mega 1 and let Mega 1 drive the relay