detecting sensors code not working and a comment on EasyVR module

Depending on how the sensor is wired, disconnecting it might leave the pin permanently in one state, or it might leave the pin floating. In neither case, will you be able to determine that the sensor is present, or not.