{{Use this with a Parallax Demoboard. It's very flexible- it includes audio, video, mouse, keyboard eeprom, and a protoype area. Print text to a terminal This program uses the terminal blocks to print text to the built-in terminal. Doing this can help you debug your programs. Here I print both strings and the value of a variable. I also position the cursor and clear the terminal. }} CON _clkmode = xtal1+pll16x _xinfreq = 5_000_000 '80 MHz _motorlpin=0 'Left motor _motorrpin=1 'Right motor _micpin=8 'Microphone _mic2pin=9 'Microphone Dac _iranodepin=1 'Common anode of ir distance sensors, driven with 38khz signal _audiolpin=10 'Audio Left _audiorpin=11 'Audio Right _videopin=12 'Video _video2pin=13 'Video _video3pin=14 'Video _video4pin=15 'Video _mousedpin=24 'Mouse Data _mousecpin=25 'Mouse Clock _keydpin=26 'Keyboard Data _keycpin=27 'Keyboard Clock _eepromDpin=28 'Eeprom Data _eepromCpin=29 'Eeprom Clock _vppin=30 'ViewPort Conduit _vp2pin=31 'ViewPort Conduit #0,right,left,forward,backward,stopit OBJ _servo:"servo32v6" _bs:"bs" _vp :"Terminal" 'terminal+conduit VAR long _outp,_inp,_io long alert long speed long x long _s_right[40] long _s_left[40] long _s_forward[40] long _s_backward[40] long _s_stopit[40] pub _main|_s_pub2[70],_s_pubright[70],_s_publeft[70],_s_pubforward[70],_s_pubbackward[70],_s_pubstopit[70] _vp.config(string("var:outp,inp,io(bits=[30tx,31rx]),alert,speed,x")) _vp.config(string("terminal:1")) _vp.config(string("lsa:view=io,timescale=1ms")) _vp.config(string("overview:view=[alert,speed,x]")) _vp.config(string("dso:view=alert")) _vp.share(@_outp,@x) 'initialize global objects and call global start blocks _bs.start(28,29) _servo.motors(_motorlpin,_motorrpin) _servo.start cognew(_pub2,@_s_pub2) repeat _io:=ina pub _broadcast(msg) case msg right:cognew(_p_right,@_s_right) left:cognew(_p_left,@_s_left) forward:cognew(_p_forward,@_s_forward) backward:cognew(_p_backward,@_s_backward) stopit:cognew(_p_stopit,@_s_stopit) -1: pub _broadcastsync(msg) case msg right:_p_right left:_p_left forward:_p_forward backward:_p_backward stopit:_p_stopit -1: pub _do_state(state) case state -1: 'other public functions pub _p_right'*(708,71):pub _p_$ _servo.go(0,0,speed)'*:_servo.go(0,0,$) _vp.str(string("RIGHT"))'*:_vp.str($) _vp.linefeed'*:_vp.linefeed pub _p_left'*(710,183):pub _p_$ _servo.go(0,0,-speed)'*:_servo.go(0,0,$) _vp.str(string("LEFT"))'*:_vp.str($) _vp.linefeed'*:_vp.linefeed pub _pub2'*(39,55):cognew($0,@_s$0) alert:=false'*:$:=$ {arbitrator}'*:{$} _vp.Clear'*:_vp.Clear _vp.str(string("Nomad Command Processor"))'*:_vp.str($) _vp.linefeed'*:_vp.linefeed _vp.str(string("Version 1.0"))'*:_vp.str($) _vp.linefeed'*:_vp.linefeed _vp.linefeed'*:_vp.linefeed speed:=30'*:$:=$ repeat'*:repeat x:=_vp.rxcheck'* 1:$:=$ if x>0'*:if $ if x=="f" '* 1:if $ %elseif $ '1%elseif $ '2%elseif $ '3%elseif $ '4%elseif $ '5%elseif $ '6%elseif $ '7%elseif $ '8%else _broadcast(forward)'* 1:_broadcast($) elseif x=="b" '1 _broadcast(backward)'* 2:_broadcast($) elseif x=="l" '2 _broadcast(left)'* 3:_broadcast($) elseif x=="r" '3 _broadcast(right)'* 4:_broadcast($) elseif x=="s" '4 _broadcast(stopit)'* 5:_broadcast($) elseif x==" " '5 _broadcast(stopit)'* 6:_broadcast($) elseif x=="1" '6 speed:=30'* 7:$:=$ elseif x=="2" '7 speed:=50'* 8:$:=$ elseif x=="3" '8 speed:=70'* 9:$:=$ else _vp.dec(x)'* 10:_vp.dec($) pub _p_forward'*(311,55):pub _p_$ alert:=false'*:$:=$ _servo.go(0,speed,0)'*:_servo.go(0,$,0) _vp.str(string("WANDER"))'*:_vp.str($) repeat 100'*:repeat $ if alert'* 1:if $ quit'* 1:quit _vp.str(string("."))'*:_vp.str($) _bs.pause(1000)'*:_bs.pause($) pub _p_backward'*(491,55):pub _p_$ _servo.go(0,-speed,0)'*:_servo.go(0,-$,0) alert:=true'*:$:=$ _vp.str(string("BACK"))'*:_vp.str($) _vp.linefeed'*:_vp.linefeed pub _p_stopit'*(491,188):pub _p_$ _servo.stop'*:_servo.stop alert:=true'*:$:=$ _vp.str(string("STOP"))'*:_vp.str($) _vp.linefeed'*:_vp.linefeed 'data DAT