Sending String from Python Program to OPC UA Client

Show the world your Revolution Pi project!
Post Reply
rejgeo
Posts: 4
Joined: 03 Jan 2025, 18:02

Sending String from Python Program to OPC UA Client

Post by rejgeo »

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
User avatar
dirk
Posts: 2271
Joined: 15 Dec 2016, 13:19

Re: Sending String from Python Program to OPC UA Client

Post by dirk »

hi Rejoy, is "self.rpi" a RevPiModIO2 object?
rejgeo
Posts: 4
Joined: 03 Jan 2025, 18:02

Re: Sending String from Python Program to OPC UA Client

Post by rejgeo »

Thanks
Post Reply