Exemplo n.º 1
0
        static void Init()
        {
            //Load sound files
            PinVoiceTools.Init();

            //Set servo
            ServoTool.Init();

            //Load pin codes
            codes = File.ReadAllLines("Assets\\codes.txt");

            //Load the current saved index, if any
            if (File.Exists("Session\\location.txt"))
            {
                pinIndex = int.Parse(File.ReadAllText("Session\\location.txt"));
            }
            else
            {
                pinIndex = 0;
            }

            //Start HTTP server
            listener = new HttpListener();
            listener.Prefixes.Add("http://10.0.1.12:80/");
            listener.Start();
            listener.BeginGetContext(OnGetRequst, null);
        }
Exemplo n.º 2
0
        static void RunAttempt()
        {
            //Log
            Console.WriteLine($"[ATTEMPT] Attempting {codes[pinIndex]}, index {pinIndex}");

            //Push button
            ServoTool.PressButton();

            //Delay
            Thread.Sleep(600);

            //Speak code
            PinVoiceTools.PlayPinCode(codes[pinIndex]);

            //Delay
            Thread.Sleep(1000);

            //Begin recording
            ResponseRecordTools.RecordResponse($"Session\\attempt_{pinIndex}", 5000);

            //Add to current value and save
            pinIndex++;
            File.WriteAllText("Session\\location.txt", pinIndex.ToString());
        }