'--------------------------------------------------------------
'                     (c) 1997-2003 MCS Electronics
'--------------------------------------------------------------
'  file: INKEY.BAS
'  demo: INKEY , WAITKEY
'--------------------------------------------------------------
Dim A As Byte , S As String * 2
Do
   A = Inkey()                                                'get ascii value from serial port
   's = Inkey()
   If A > 0 Then                          'we got something
      Print "ASCII code " ; A ; " from serial"
   End If
Loop Until A = 27                       'until ESC is pressed

A = Waitkey()                                                 'wait for a key
's = waitkey()
Print Chr(a)

'wait until ESC is pressed
Do
Loop Until Inkey() = 27

'When you need to receive binary data and the bibary value 0 ,
'you can use the IScharwaiting() function.
'This will return 1 when there is a char waiting and 0 if there is no char waiting.
'You can get the char with inkey or waitkey then.
End