serial input


Author Message
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 699
Posted: 11:21pm 11 Jun 2025      

  mozzie said  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.


INPUT$(n,#c) will wait until n characters have arrived from channel #c won't it?