i am wondering how to pause the serial input to stop the listener while robyn is explaining about his servos for example and then start the listener again https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Markus/Skin.py

if (num == 1):

    stop listener

    servo()

    start listener

GroG

8 years 10 months ago

Guess your using version 119 ?

Make the listener references global

listener1 = MRLListener('publishRX', 'python', 'serial1RX', None)

So in a method

def foo():

    global listener1, serial1
    if (num == 1):
           serial1.removeListener(listener1)

            servo()

             serial1.addListener(listener1)

 

if servo has non blocking stuff - you might have to pause for a little after servo..