Scribbler 1 Following Routine
I was PM'ed asking how to get Scribblers to follow each other as shown at https://www.youtube.com/watch?v=seQXPRXzHtQ . The simplest code to follow a slow-moving white target (or your hand) is sinfully simple:
' {$STAMP BS2} ' {$PBASIC 2.5} PAUSE 500 DO FREQOUT 14, 1, 38500 ' send right IR pulse B0=IN6 IF B0=0 THEN PULSOUT 12, 2000 ELSE PULSOUT 12, 2400 FREQOUT 15, 1, 38500 ' send left IR pulse B0=IN6 IF B0=0 THEN PULSOUT 13, 2000 ELSE PULSOUT 13, 2400 PAUSE 50 LOOP
Comments
TTYTT, the code I posted was hastily edited from longer code which had some additional IF checks to switch on the green LEDs, as shown in the video. I stored the value of IN6 in case it changed between IF checks.