you need to use GET #, and PUT # when communing with the COM ports with QB64
little example from my robotics control, controlling a remote fired static mounted firearm.
in Simulation it, sends fire command PUT #1, and checks weapon status with GET #1 over and over checking for weapon jam, ammo depleted and weapon mounting secured.Code: QB64: [Select]
On a side note, I would move away from using GOSUB and RETURN
Hi;
I have tested the code posted by Cobalt but I have error message #68 Line 1 (in main module) Device unavailable.
A am using to test two USB TTL converters . One to be linked to program was changed to COM1 in the W10 device manager and it is available and could be opened by a terminal program. It seems does not work also with other C OM ports numbers.