Comm between ESP32-CAM and Arduino Uno/Mega

A good place to start would be the Serial Input Basics tutorial.