'co.bs2 Arrick Robotics www.robotics.com ' 'This routine controls the coprocessor. It accepts 'commands from the master and controls two LEDs. charn var byte 'input variable. chart var byte 'output variable. grn con 1 'led pins. red con 2 baud con 396 'baud rate. net con 0 'network I/O pin. conid con "2" 'controller ID. low grn 'turn on green led to signify power. main gosub getchar if charn <> "!" then main 'loop if not !. gosub getchar 'get next char. if charn <> conid then main 'check conid. gosub getchar if charn = "R" then redled 'check for "R". if charn = "G" then grnled 'check for "L". mainb pause 100 'wait 100 ms. chart="B" gosub putchar 'B = bad cmnd. goto main 'loop forever. maina chart="A" 'A=acknowledge. gosub putchar 'output "A". goto main 'loop forever. redled gosub getchar 'get next char. if charn = "1" then redled1 '1=on. if charn = "0" then redled0 '0=off. goto mainb 'bad char? redled1 low red 'turn on red led. goto maina 'done. redled0 high red 'turn off red led. goto maina 'done. grnled gosub getchar 'get next char. if charn = "1" then grnled1 '1=on. if charn = "0" then grnled0 '0=off. goto mainb 'bad char? grnled1 low grn 'turn on red led. goto maina 'done. grnled0 high grn 'turn off red led. goto maina 'done. getchar serin net,baud,[charn] 'input a char. return putchar serout net,baud,[chart] 'output a char. return