feature_lsp_com #9

Merged
musabe24 merged 12 commits from feature_lsp_com into main 2024-07-22 12:15:27 +02:00
Showing only changes of commit db17fbc1d9 - Show all commits

14
main.py
View File

@@ -445,23 +445,19 @@ class ArduinoGUI:
if self.ser.in_waiting:
try:
command = ""
command = self.ser.read().decode(errors='ignore').strip()
while self.ser.in_waiting:
pass
print(command)
command += self.ser.read(1).decode(errors='ignore').strip()
if command[0] == 'a':
message = f"{self.current_angle};{self.current_torque};{self.analogInput};{self.currentSetpoint};{self.currentOutput}\n"
self.ser.write(message.encode())
if command[0] == 'w':
self.tare_angle()
if command[0] == 'u':
outCommand = F"{command}\n"
self.arduino.write(outCommand.encode())
outCommand = F"command: {command}\n"
selr.arduino.write(outCommand.encode())
time.sleep(0.1)
while self.ser.out_waiting:
pass
self.ser.read_all()
self.ser.read()
except Exception as e:
print(e)
#self.ser.write(b'Hallo\n')