Same code working differently on Nano 33 IoT and Mega

How is the sensor powered ?