summaryrefslogtreecommitdiffstats
path: root/Kod/scripts
diff options
context:
space:
mode:
authorAlbin <albwa833@student.liu.se>2019-11-08 12:01:40 +0100
committerAlbin <albwa833@student.liu.se>2019-11-08 12:01:40 +0100
commit984296b90a2ddcb8bbf913b9ac97d1be2045bfab (patch)
tree8571ccac59c7a2817e1bfb22d0cee6f582d741a9 /Kod/scripts
parent9605ca3f80511400489163d73fe013e5235e0332 (diff)
downloadtfyy51-984296b90a2ddcb8bbf913b9ac97d1be2045bfab.tar.gz
Lägg till test_givare
Diffstat (limited to 'Kod/scripts')
-rw-r--r--Kod/scripts/test_givare.m38
1 files changed, 38 insertions, 0 deletions
diff --git a/Kod/scripts/test_givare.m b/Kod/scripts/test_givare.m
new file mode 100644
index 0000000..204d501
--- /dev/null
+++ b/Kod/scripts/test_givare.m
@@ -0,0 +1,38 @@
+disp('Startar bilbanan. Avsluta med q.')
+hf=figure('position',[0 0 eps eps],'menubar','none');
+
+initialize_counters(1)
+initialize_counters(2)
+
+start_race(1)
+start_race(2)
+
+config_IOs
+
+car1 = struct;
+car2 = struct;
+
+while 1
+ %% PRE-LOOP
+ if strcmp(get(hf,'currentcharacter'),'q')
+ close(hf)
+ break
+ end
+
+ figure(hf)
+ drawnow
+
+ %% READ
+ [car1.new_lap, car1.new_check_point, car1.time] = get_car_position(1);
+ [car2.new_lap, car2.new_check_point, car2.time] = get_car_position(2);
+
+ if car1.new_lap == true || car1.new_check_point == true || car2.new_lap == true || car2.new_check_point == true
+ beep;
+ end
+
+ pause(0.1)
+end
+
+%%
+terminate(1)
+terminate(2) \ No newline at end of file