Get a button to call this function when pressed and released. def SimProbeButton(self, state): if state: hal.set_P('motion.probe-input','1') else: hal.set_P('motion.probe-input','o')