Dibatalkan

Help with a serial response in python

I have a response i am parsing that has two lines. I a parsing the first line no problem but it leaves junk in the input buffer for next time

Its the code:

# Poll GRBL for parser status 1 second max

tries = 0

while tries < 2:

[login to view URL]() # Flush startup text in serial input

[login to view URL]("$G\n".encode())

pstatus_out = [login to view URL]().decode().strip() # Wait for GRBL response with status return message

if pstatus_out != "":

if 'error' in [login to view URL](): # Check For Error

error_3 = error_2 # Rotate Error Log

error_2 = error_1 # Rotate Error Log

error_1 = "GRBL " + [login to view URL]() # Set error 1 to current error

grbl_motion, grbl_units, grbl_spindle, grbl_coolant = parse_grbl_parser(pstatus_out)

[login to view URL]() # Flush startup text in serial input

break

sleep(.2)

tries += 1

if tries >= 2:

error_3 = error_2 # Rotate Error Log

error_2 = error_1 # Rotate Error Log

error_1 = "GRBL Timeout Parser Status" # Set error 1 to current error

grbl_motion, grbl_units, grbl_spindle, grbl_coolant = parse_grbl_parser(pstatus_out)

The Function is

def parse_grbl_parser(pstatus_out):

try:

pstatus_out = [login to view URL](":", 1)[1].replace("]", "")

pstatus_out = [login to view URL](" ")

grbl_motion = pstatus_out[0]

grbl_units = pstatus_out[3]

grbl_spindle = pstatus_out[6]

grbl_coolant = pstatus_out[7]

except:

grbl_motion = "Err"

grbl_units = "Err"

grbl_spindle = "Err"

grbl_coolant = "Err"

return grbl_motion, grbl_units, grbl_spindle, grbl_coolant

The response is

[GC:G0 G54 G17 G20 G90 G94 M5 M9 T0 F0.0 S0]

ok

Kemahiran: Python, Arduino, Elektronik, Kejuruteraan Perisian, Mikropengawal

Lihat lagi: comic strip artist message board, wait message anim google map, google maps animated wait message, pulse width modulation serial decode python, php display wait message, animated wait message flash, wait message asp redirect, help paypal functionality python gae app, read serial response, help converting java python, usb serial converter python pyserial, serial mysql python, india help with gcse python programming, I need help with a python script, raspberry pi arduino serial communication python, raspberry pi serial communication python, json response python, selenium get network response python, raspberry pi get serial number python, read api response python

Tentang Majikan:
( 4 ulasan ) Strafford, United States

ID Projek: #29417172

3 pekerja bebas membida secara purata $33 untuk pekerjaan ini

Masatrian

Hello, I am Manana from Armenia Yerevan. I read your description in detail. I have experiences at web security and can help you. I am very excited on your project, and I am ready to start work immediately. I have skil Lagi

$50 USD dalam 7 hari
(5 Ulasan)
3.6
faizanmaqbool695

Hi there, I have read your project description and I am confident about your project I can do perfectly. Please leave a message on my chat so we can discuss the budget and deadline of the project. Thanks. regard , fa Lagi

$20 USD dalam sehari
(7 Ulasan)
3.7
Pythonrider

Hi there, I'm interested in this, and let me check your serial data sample, too. The data you directly pasted on the project desciption is re-formatted by this system, so I think it has different spacings. To start wor Lagi

$30 USD dalam sehari
(0 Ulasan)
0.0