Below is the code I’m using. The code is inside a button mouse click event. I also have another button that configures the serial port settings. The serial device I’m using connects to the computer through a USB port but it shows up in my device manager as a serial port.
The USB device came with a small program that will let me type the “BB 03 00 47” hex code and write it, then it reads the response from the network. I have use this program and I get the correct response back.
Also the USB device has a small red LED on it that turns when a message is sent to it. The light never comes on when I push the button in Ignition, but it does when using the program that came with the device.
I will try the code above. The manual that came with UBS device indicates the red led will turn every time the device sees a message. Is there any chance that my code is not opening com8 port. Also I tried to use the read line function and it did not detect any data when data was available at the port.
When I try using the system.serial.writeBytes the system throws an error that the value for “BB” 187 is out of range. How do I change the write bytes to expect unsigned values?
The call is being done with a button (Mouse Click Event). I did an independent test using the Hercules terminal program, it’s like hyperterminal only easier to use. I was able to write and read the serial data. This terminal software is not related to the device I’m using so it should not be manipulating the message (meaning it’s not adding any additional data to the message).
Now the next step is to read data. The write message above doesn’t request the device to provide a response, but I do have other write commands that do. So is there away to cast the system.serial.readBytes data to HEX? Also is there any way to create a port listener? If so will the port listener need to be disabled when a write command is activated?