Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 67412

Need help converting python code to Labview

$
0
0

I have a device that is requiring a string command send to it in bytes through a serial port.  I am not familiar with this and could use some help.  I have included the python code for writing and reading the port.  How to I create the "Bytes() and Bytes.decode() commands in Labview?

 

# encode the command to get the device SN in bytes, and write it to the devicecommand="255:R:OCODE:1\r\n"command_in_bytes=bytes(command, 'utf-8')port.write(command_in_bytes)
# read the first 500 characters (or less if it times out), convert it to a string, and print itresponse=port.read(size=500)response_as_str=bytes.decode(response, 'utf-8')print(response_as_str)

 Thanks

Terry


Viewing all articles
Browse latest Browse all 67412

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>