added flushInput before sending next command to avoid buffer full of READY

This commit is contained in:
ketrptr 2025-04-03 11:56:20 +02:00
parent 024c0ff9e3
commit 5adcaf6239
2 changed files with 33 additions and 0 deletions

13
demSequence.py Normal file
View File

@ -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)

View File

@ -22,6 +22,7 @@ class meArm:
[print(i, x) for i, x in enumerate(self.moves)] [print(i, x) for i, x in enumerate(self.moves)]
def sendCmd(self, cmd = b'H1'): def sendCmd(self, cmd = b'H1'):
self.ser.flushInput() #Last change. if broken remove this
while(1): while(1):
line = self.ser.readline() line = self.ser.readline()
# print(f"sendCmd: {line}") # print(f"sendCmd: {line}")
@ -53,6 +54,25 @@ class meArm:
c+=1 c+=1
if c ==2: break if c ==2: break
if __name__ == '__main__': if __name__ == '__main__':