Are you sure the WifiNINA library is correct for that board?
Some of the newer board platforms use an enum for PinStatus instead of the traditional HIGH and LOW for digitalWrite, as well as for attaching interrupts. The board platform for the Mega likely does not support this, while WifiNINA is mostly used on the newer boards.
typedef enum {
LOW = 0,
HIGH = 1,
CHANGE = 2,
FALLING = 3,
RISING = 4,
} PinStatus;
< edit > Does the HiLetgo Mega have an ESP8266 based wifi?