A clueless chemical engineer here looking for some help. I am trying to use an Arduino Mega to control an experiment and need to have the following functionality: monitor for incoming serial commands (from ML algorithm in MATLAB), control two devices via PWM, control 18 devices on/off via relays and control 3 devices in a pulsed manner (on for x seconds, off for y seconds). Problem is I need all of this to happen simultaneously. Is there any way to do this? Thank you in advance for your guidance.