In This program btn_device is mapped to the 4 push-buttons a…