Robot: Kajtek
Data wykonania: 09.06.2010 godz. 17:00
Autorzy: Łukasz Bartos, Magdalena Bytom, Grzegorz Świeczkowski
Sprawozdanie 6
Budowa robota
Implementacja
:- consult('plnxt.pl').
start :-
nxt_open,
nxt_light_LED(activate, force),
trigger_create(_,check_light, change_angle, 100),
trigger_create(_,check_red, go_away,100),
trigger_create(_,check_sound, go_away_with_friend,100),
nxt_go(300).
stop :-
trigger_killall,
nxt_light_LED(passivate, force),
nxt_stop,
nxt_close.
change_angle :-
Angle is 100 + random(60),
nxt_rotate(360, Angle, force),
nxt_go(300).
check_light :-
nxt_light(Light,force),
Light < 44.
check_red :-
nxt_light(Light,force),
Light < 66,
Light > 62.
check_sound :-
nxt_sound(Sound,force),
Sound > 90.
go_away_with_friend :-
nxt_go(800,5),
write('uciekam'),
stop.
go_away :-
nxt_play_tone(500,400),
write('juz'),
nxt_go(800,5),
stop.
Problemy, spostrzeżenia