serial input


Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6433
Posted: 03:16am 10 Jun 2025      

One example where I send a command and wait for a reply.
Using GP1 and GP0

'
SETPIN GP1,GP0,COM1
 OPEN "COM1: 19200" AS #3
...
 
FUNCTION sendData$(txt$)
 LOCAL echo$, n
 PRINT #3, txt$;
 PAUSE 30
 echo$ = INPUT$(200,#3)
 sendData$ = MID$(echo$,LEN(txt$)+1)
  'for n = 1 to len(echo$)
    'print hex$(asc(mid$(echo$,n,1)),2);
  'next n
  'print
END FUNCTION


I notice that you used Data$ as a variable.
I am not comfortable using keywords as variable names but you can get away with it sometimes.

Jim