diff --git a/state_machine.m b/state_machine.m
new file mode 100644
index 0000000000000000000000000000000000000000..8cb88e8161590e57b49f4a024f2f4339c56b7a90
--- /dev/null
+++ b/state_machine.m
@@ -0,0 +1,33 @@
+% States
+
+
+while(true)
+    audio = get_audio();
+    
+    az = get_azimuth();
+    
+    set_ref_az(-az);
+    
+    if ~abs(az) < th_az
+        continue
+    end
+    
+    % The angle to the source is small enough, take a step forward
+    
+    step_forward(distance);
+    
+    if ~there()
+        continue
+    end
+    
+    % We are there, analyze the source
+    
+    source_label = analyze_source(audio);
+    display('Source label determined')
+    disp(source_label)
+    key = input('Press any key to continue, press c to exit: ','s');
+    if key == 'c'
+        break
+    end
+    
+end
\ No newline at end of file