version 2.01 platform ollo o // param_text:Title : 2nd Avoider example 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:Please control the moving speed by changing the below value. : 0 ~ 1023 o load param_dest:var:MovingSpeed param_src:dec_num:600 - o while(1) o begin o if param_src:cm:50 lop:< param_src:dec_num:100 rop:&& param_src:cm:52 lop:>= param_src:dec_num:100 rop:then o begin o // param_text:It will change its course in the right direction when a line is detected from the left sensor. o compute param_dest:aux_motor:1 param_src:dir_num:0 aop:+ param_src:var:MovingSpeed o compute param_dest:aux_motor:2 param_src:dir_num:0 aop:+ param_src:var:MovingSpeed o end o elseif param_src:cm:50 lop:>= param_src:dec_num:100 rop:&& param_src:cm:52 lop:< param_src:dec_num:100 rop:then o begin o // param_text:It will change its course in the left direction when a line is detected from the right sensor. o compute param_dest:aux_motor:1 param_src:dir_num:1024 aop:+ param_src:var:MovingSpeed o compute param_dest:aux_motor:2 param_src:dir_num:1024 aop:+ param_src:var:MovingSpeed o end o elseif param_src:cm:50 lop:>= param_src:dec_num:100 rop:&& param_src:cm:52 lop:>= param_src:dec_num:100 rop:then o begin o // param_text:When an object is detected from both right and left sensor, it will back off. o compute param_dest:aux_motor:1 param_src:dir_num:0 aop:+ param_src:var:MovingSpeed o compute param_dest:aux_motor:2 param_src:dir_num:1024 aop:+ param_src:var:MovingSpeed o end o else o begin o // param_text:It will go straight for other cases. o compute param_dest:aux_motor:1 param_src:dir_num:1024 aop:+ param_src:var:MovingSpeed o compute param_dest:aux_motor:2 param_src:dir_num:0 aop:+ param_src:var:MovingSpeed o end o end o end >