:- consult('plnxt.pl'). start :- nxt_open, go_on, trigger_create(_,check_touch, [nxt_stop, nxt_close]). go_on :- nxt_go(300), trigger_create(_,check_distance, zawroc). check_distance :- nxt_ultrasonic(Distance,force), Distance < 35. zawroc :- nxt_stop, nxt_rotate(400,180), go_on. check_touch :- nxt_touch(V,force),V = 1.