Sending String from Python Program to OPC UA Client
Posted: 03 Jan 2025, 19:52
Hi,
Can some show an example how can i send a barcode string value from RevPI to OPC UA Client.
I tried
self.rpi.io.Input_1_OPC.replace_io("barcode_bytes", "B") # 'B' signifies byte type
barcodestring = "A23456" # Example barcode
# Convert the barcode string to bytes (assuming UTF-8 encoding)
barcode_bytes = barcodestring.encode('utf-8')
print(int(barcode_bytes)) # Print Results shows b'A23456'
self.rpi.io.barcode_bytes.value = int(barcode_bytes)
Thanks for the help,
Rejoy
Can some show an example how can i send a barcode string value from RevPI to OPC UA Client.
I tried
self.rpi.io.Input_1_OPC.replace_io("barcode_bytes", "B") # 'B' signifies byte type
barcodestring = "A23456" # Example barcode
# Convert the barcode string to bytes (assuming UTF-8 encoding)
barcode_bytes = barcodestring.encode('utf-8')
print(int(barcode_bytes)) # Print Results shows b'A23456'
self.rpi.io.barcode_bytes.value = int(barcode_bytes)
Thanks for the help,
Rejoy