serial input


Author Message
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 196
Posted: 11:32am 09 Jun 2025      

G'day Georges,
The following might explain the situation.

OPEN "COM1:115200" as #1
When the serial port is opened, the receive buffer is cleared.

IF LOC(#1) > 10 THEN data$ = INPUT$(256, #1)
Now we check the buffer, which is empty, so data$ is also empty.

So we need to wait for the data to arrive:

OPEN "COM1:115200" as #1
Do while LOC(#1)<10
' loop here until 10 chars in input buffer
Loop
data$ = INPUT$(255, #1)
print data$

You can also use interrupts but hopefully this will help.

Regards,
Lyle.
Edited 2025-06-09 21:33 by mozzie