working code to read current digital output status