8x8 Matrix - Hall sensor error

Did you check the pull-up resistor at the sensor? (Note: The MEGA can enable internal pull-up resistors on each input so external pull-ups are not necessary.)

Check the voltage on Pin 53 (H7) with and without the magnet. If the input doesn't change or is a value that is not close to 0.0V or 5.0V then something is probably wrong with the wiring. If you can't fit a little probe into the top of the cable connector, probe the bottom of the pin on the underside of the MEGA board.

If the signal looks weird, try unplugging the cable from the MEGA and probing the cable alone. If the signal then looks good, the problem is something in the MEGA.