Serial comms on picomite


Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3036
Posted: 04:01pm 02 Feb 2024      

Welcome to the forum.

MMBasic has excellent serial communications handling. Depending on circumstances, you'd probably do best with something like this (untested):

SETPIN GP5, GP4, COM2 '
OPEN "COM2:1200" AS #5 '

do
 Do
   'HERE you want to put any code which is needed between receipt of characters, e.g.,
   if dat$ <> "" then
'     your code
     dat$=""
   endif
 Loop While Loc(#1)=0
 Pause 100 ' let characters arrive on COM1 (approx 10 per 100ms--increase as needed)
 dat$ = INPUT$(255, #5) 'get up to 255 characters
loop