See the method used in the GPAD factory test at: https://github.com/PubInv/general-alarm-device/blob/main/Firmware/GPAD_Factory_Test/GPAD_Factory_Test.ino