input $ expects n characters from the terminal (or serial link rx0);
temp.input $ expects n characters from treminal or rx0. If the timeout is exceeded, returns an empty string or the characters received.
This function is particularly useful when you are expecting characters transmitted over a serial link, such as a LoRa transmitter for example.
The advantage of temp.input $ is that it does not wait indefinitely for a transmission or a transmission that does not end with cr.
-inputmarker -input\ accept n characters from terminal FORTH buffer\ leave addr n :input$( n --- addr n)pad swapacceptpad swap;2000valueIN_DELAY\ increase or decrase if necessary:temp.rx0IN_DELAYbegin1- 1msrx0?\ char recevied from rx0 ?if droprx0exitthendup 0= untildrop 13\ if no char, leave $0a (cr);\ temporised input:temp.input$( n --- addr n)['] temp.rx0'key!input$['] rx0'key!;
Last edit: PETREMANN 2020-11-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
input $ expects n characters from the terminal (or serial link rx0);
temp.input $ expects n characters from treminal or rx0. If the timeout is exceeded, returns an empty string or the characters received.
This function is particularly useful when you are expecting characters transmitted over a serial link, such as a LoRa transmitter for example.
The advantage of temp.input $ is that it does not wait indefinitely for a transmission or a transmission that does not end with cr.
Last edit: PETREMANN 2020-11-21