main:
if pinB.5=0 then
setfreq m16 ;is the type of movement input low?
MovementType=0 ;yes, set the index to start of table
low EyesOutput ;and set Eyes output to low (off)
Temp_LSB=7 ;and do all 7 movement types
else
setfreq m4
pause 500
serout TENDA,4800, (01) 'Play MP3
pause 500
servo B.2,210 'turn head
servopos B.2,210
for b16=1 to 5 'delay for mp3
pause 1000
next b16
servopos B.2,130 'turn head
pause 500
setfreq m16
MovementType=HeadDataSize ;no, set the index to start of second data table
High EyesOutput ;and set Eyes output to High (on)
Temp_LSB=5 ;Don't do LookAt or NodNo
endif
Random Random_Word ;get next random number
Temp_LSB=Random_MSB * Temp_LSB /256; ;get a random from 0 to 4 or 0 to 6
if LastCommand = Temp_LSB then Main ;get another command if repeating the last one.
On Temp_LSB gosub LookHome,LookFarLeft,LookNearLeft,LookFarRight,LookNearRight,LookAt,NodNo
Goto Main