Ir remote controlled Scribbler2
Ok - now that I have a S2, here is my very simple program to move your S2 around using a compatible Sony tv remote menu arrow buttons. This is a very simple program that only uses the S2's 38khz ir obstacle detector for an ir receiver and the S2's wheel motors. I commented the code.
Con 'simple scribbler2 sony tv ir remote control program by David Ratcliff "ratronic" 12/9/11 _clkmode = xtal1 + pll16x 'set up clock for s2 @ 80mhz (5mhz crystal * 16pll) _xinfreq = 5_000_000 ' Var long irc 'irc = sony ir tv remote control code # for button being pressed 'or irc = 255 if no button is being pressed Obj ir : "irtest" 'sony ir tv remote decoder object s2 : "s2" 'scribbler2 object Pub main s2.start 'start s2 object s2.start_motors 'start s2 motors ir.start(s2#obs_rx, @irc) 'start sony ir tv remote decoder object using s2 obstacle detector for ir receiver s2.set_speed(15) 'set scribbler2 moving speed, can be set from 0=stop to 15=full speed) repeat if irc == 116 'arrow-up button move s2 forward s2.go_forward(1) if irc == 117 'arrow-down button move s2 in reverse s2.go_back(1) if irc == 52 'arrow-left button turn s2 left s2.turn_by_deg(1) if irc == 51 'arrow-right button turn s2 right s2.turn_by_deg(-1) if irc == 255 'no button on remote being pressed s2 stop s2.wait_stop