sensor function