From 5adcaf623953841091a99e3fc4ce1fa5fdafd5c9 Mon Sep 17 00:00:00 2001 From: ketrptr Date: Thu, 3 Apr 2025 11:56:20 +0200 Subject: [PATCH] added flushInput before sending next command to avoid buffer full of READY --- demSequence.py | 13 +++++++++++++ meControll.py | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 demSequence.py diff --git a/demSequence.py b/demSequence.py new file mode 100644 index 0000000..bfef2ff --- /dev/null +++ b/demSequence.py @@ -0,0 +1,13 @@ +import meControll + +arm = meControll.meArm() + +pickupLeft = [b'S1', b'T130', b'R110', b'L50', b'R150',b'G170', b'R110' ] +drop_right = [b'S1', b'T50', b'R150', b'G90', b'R100', b'D1'] + +arm.addMove(pickupLeft) +arm.addMove(drop_right) +arm.execMove(0) +arm.execMove(1) + + diff --git a/meControll.py b/meControll.py index e73b573..4beaaf5 100644 --- a/meControll.py +++ b/meControll.py @@ -22,6 +22,7 @@ class meArm: [print(i, x) for i, x in enumerate(self.moves)] def sendCmd(self, cmd = b'H1'): + self.ser.flushInput() #Last change. if broken remove this while(1): line = self.ser.readline() # print(f"sendCmd: {line}") @@ -53,6 +54,25 @@ class meArm: c+=1 if c ==2: break + + + + + + + + + + + + + + + + + + + if __name__ == '__main__':