Python Forum

Full Version: Post serial results
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I am new to Python but have found code that does what I need to an extent.

I have a scale with an rs232 out. I have modified the python code to my scales config and it now delivers the scale output to the terminal window on my raspberry pi when I click the print button on the scale.

I also have a barcode scanner attached which writes the barcode to the terminal window.

#!/usr/bin/env python3
import time
import serial

ser = serial.Serial(
 port='/dev/ttyUSB0',
 baudrate = 2400,
 parity=serial.PARITY_EVEN,
 stopbits=serial.STOPBITS_ONE,
 bytesize=serial.SEVENBITS,
 timeout=None
)

while 1:
 x=ser.readline()
 print(x)
How can I send the print output to a url? Ideally I would like it to be written back to my database via a url but even if it could be written to a local database, that would be helpful.

The other aspect that I can seem to get is line above the scale reading, which is inserted from the barcode reader.

[Image: yXiCWOP]

Any advice or assistance would be greatly appreciated.

Thanks

BMC