version 2.01 platform ollo o // param_text:Title- 3rd teaching program chapter 1 example (Crossing gate) o // param_text:First Distribution : 2009/10/01 o // param_text:Last Modify : 2009/10/01 o // param_text:[Operating] o // param_text:Robot will move according to the sensor value. o main o begin o // param_text:It will play melody when it starts. o load param_dest:cm:55 param_src:buzzertime_num:255 o load param_dest:cm:54 param_src:melody_num:3 o wait param_src:cm:55 lop:> param_src:buzzertime_num:0 rop:then - o // param_text:Set up the Serovo(PORT[3]) and LED (PORT[4]) o load param_dest:aux_led:4 param_src:led_num:0 o load param_dest:aux_servo:3:0 param_src:bool_num:1 o load param_dest:aux_servo:3:1 param_src:dir_num:2047 - o // param_text:Set up the sensor value at 100 to decide if there exists an object. o load param_dest:var:ObjectDistance param_src:dec_num:100 - o // param_text:Set up the gate position o load param_dest:var:GateClosePosition param_src:dec_num:510 o load param_dest:var:GateOpenPosition param_src:dec_num:780 - o while(1) o begin o // param_text:When an object is detected from a central distance sensor, o if param_src:cm:51 lop:>= param_src:var:ObjectDistance rop:then o begin o // param_text:The gate will be lifted up, and No.1 LED will be lit. o load param_dest:aux_servo:3:2 param_src:var:GateOpenPosition o load param_dest:aux_led:4 param_src:led_num:2 o end o else o begin o // param_text:The gate will be lifted down, and No.2 LED will be lit. o load param_dest:aux_servo:3:2 param_src:var:GateClosePosition o load param_dest:aux_led:4 param_src:led_num:1 o end o end o end Èø