Ejemplo n.º 1
0
        /// <summary>
        /// *****************************************************************
        /// *                  Connect the Finch Robot                      *
        /// *****************************************************************
        /// </summary>
        /// <param name="finchRobot">finch robot object</param>
        /// <returns>notify if the robot is connected</returns>
        static bool DisplayConnectFinchRobot(Finch finchRobot)
        {
            Console.CursorVisible = false;

            bool robotConnected;

            DisplayScreenHeader("Connect Finch Robot");

            Console.WriteLine("\tAbout to connect to Finch robot. Please be sure the USB cable is connected to the robot and computer now.");
            DisplayContinuePrompt();

            robotConnected = finchRobot.connect();

            if (robotConnected)
            {
                Console.WriteLine("Connect Finch Robot");
                finchRobot.setLED(0, 255, 0);
                finchRobot.noteOn(261);
                finchRobot.wait(1000);
                finchRobot.setLED(0, 0, 0);
                finchRobot.setLED(0, 0, 0);
            }

            // TODO test connection and provide user feedback - text, lights, sounds

            DisplayMenuPrompt("Main Menu");

            //
            // reset finch robot
            //
            finchRobot.setLED(0, 0, 0);
            finchRobot.noteOff();

            return(robotConnected);
        }
Ejemplo n.º 2
0
 static void NominalIndicator(Finch sentryBot)
 {
     sentryBot.setLED(0, 255, 0);
     sentryBot.wait(500);
     sentryBot.setLED(0, 0, 0);
     sentryBot.wait(100);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// *****************************************************************
        /// *               Talent Show > Mixing It Up                      *
        /// *****************************************************************
        /// </summary>
        /// <param name="myFinch">finch robot object</param>
        static void DisplayMixingItUp(Finch myFinch)
        {
            Console.CursorVisible = false;
            DisplayScreenHeader("Mixing It Up");
            Console.WriteLine("\tTHE FINCH ROBOT WILL NOW MIX IT UP ON YA' ");
            DisplayContinuePrompt();
            myFinch.setLED(255, 0, 0);
            myFinch.noteOn(261);
            myFinch.wait(1000);
            myFinch.noteOff();
            myFinch.setLED(0, 255, 0);
            myFinch.setMotors(50, 200);

            for (int frequency = 0; frequency < 20000; frequency = frequency + 100)
            {
                myFinch.noteOn(frequency);
                myFinch.wait(2);
                myFinch.noteOff();
            }

            myFinch.wait(3000);
            myFinch.setMotors(0, 0);
            myFinch.setMotors(-200, -200);
            myFinch.wait(1000);
            myFinch.setMotors(0, 0);
            myFinch.setLED(0, 0, 0);
            DisplayMenuPrompt("Talent Show Menu");
        }
Ejemplo n.º 4
0
        static void DisplayActivateSentryBot(double lowerTempThreshold, int upperLightThreshold, Finch sentryBot)
        {
            DisplayHeader("Activate Sentry Bot");

            Console.WriteLine(sentryBot.getTemperature());
            Console.WriteLine(lowerTempThreshold);
            do
            {
                NominalIndicator(sentryBot);
            } while (!TemperatureBelowThresholdValue(lowerTempThreshold, sentryBot) && !LightAboveThresholdValue(upperLightThreshold, sentryBot));

            if (TemperatureBelowThresholdValue(lowerTempThreshold, sentryBot))
            {
                Console.WriteLine();
                Console.WriteLine("The temperature has gone below the threshold value.");
                sentryBot.noteOn(500);
                sentryBot.setLED(255, 0, 0);
                DisplayContinue();
                sentryBot.noteOff();
                sentryBot.setLED(0, 0, 0);
            }
            else if (LightAboveThresholdValue(upperLightThreshold, sentryBot))
            {
                Console.WriteLine();
                Console.WriteLine("The light has exceded the threshold value.");
                sentryBot.noteOn(400);
                sentryBot.setLED(0, 0, 255);
                DisplayContinue();
                sentryBot.noteOff();
                sentryBot.setLED(0, 0, 0);
            }
        }
Ejemplo n.º 5
0
        ///<summary>
        ///******************************************************
        ///*                Talent Show "Mix It Up"
        ///******************************************************
        /// </summary>
        /// <param name="finchRobot">finch robot object</param>

        static void DisplayMixingItUp(Finch finchRobot)
        {
            Console.CursorVisible = false;

            DisplayScreenHeader("Mixing It Up");

            Console.WriteLine("The Finch robot will now \"mix it up\" for you!");
            DisplayContinuePrompt();

            finchRobot.setLED(255, 0, 0);
            finchRobot.noteOn(50);
            finchRobot.wait(2000);
            finchRobot.noteOff();
            finchRobot.setMotors(255, 255);
            finchRobot.wait(2000);
            finchRobot.setMotors(255, 0);
            finchRobot.wait(2000);
            finchRobot.setLED(0, 0, 0);
            finchRobot.setMotors(0, 0);
            finchRobot.noteOn(100);
            finchRobot.wait(1000);
            finchRobot.noteOff();
            finchRobot.setLED(0, 255, 0);
            finchRobot.wait(5000);

            DisplayMenuPrompt("Talent Show Menu");
        }
Ejemplo n.º 6
0
        static void DisplayActivateSentrybot(double lowerTempThresholdValue, Finch myfinch, double lowerLightThreshold)
        {
            double ambientTemp;
            double ambientLight;

            ambientTemp = myfinch.getTemperature();
            //ambientLight = myfinch.getRightLightSensor() + myfinch.getLeftLightSensor();
            ambientLight = myfinch.getLightSensors().Average();

            DisplayHeader("Activate Sentry Bot");
            Console.WriteLine($"The ambient temperature is {ambientTemp}");
            Console.WriteLine($"The lower Temperature Threshold is {lowerTempThresholdValue}");

            while (!TemperatureBelowThresholdValue(lowerTempThresholdValue, myfinch) && !LightAboveThresholdValue(lowerLightThreshold, myfinch))
            {
                Console.WriteLine($"light threshold{lowerLightThreshold}, light {ambientLight}, temp threshold {lowerTempThresholdValue}, temp {ambientTemp}");
                TemperatureNominalIndicator(myfinch);
            }

            //if (TemperatureBelowThresholdValue(lowerTempThresholdValue, myfinch) && LightAboveThresholdValue(lowerLightThreshold, myfinch))
            //{
            myfinch.noteOn(250);
            myfinch.setLED(255, 0, 0);
            myfinch.wait(3000);
            myfinch.noteOff();
            myfinch.setLED(0, 0, 0);
            //}

            DisplayContinuePrompt();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Shut down the Finch robot
        /// </summary>
        /// <param name="myFinch"></param>
        private static void TerminateFinch(Finch myFinch)
        {
            Console.Clear();

            Console.WriteLine();
            Console.WriteLine("Attempting to disconnect from the Finch robot.");
            Console.WriteLine();

            //
            // Audio/visual feedback to user
            //
            for (int increment = 255; increment > 0; increment -= 10)
            {
                myFinch.setLED(0, increment, 0);
                myFinch.noteOn(increment * 100);
                myFinch.wait(200);
            }
            myFinch.setLED(0, 0, 0);
            myFinch.noteOff();

            myFinch.disConnect();

            Console.Clear();

            Console.WriteLine();
            Console.WriteLine("The Finch robot is now disconnected.");
            Console.WriteLine();

            DisplayContinuePrompt();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// connects to the the finch and displays a connection confirmation, Returns bool isConnect
        /// </summary>
        /// <param name="myFinch"></param>
        private static bool GetConnectToFinch(Finch myFinch)
        {
            bool isConnected;

            //
            // connect to the finch
            //
            if (myFinch.connect())
            {
                //
                // the finch displays lights
                //
                myFinch.setLED(255, 0, 0);
                myFinch.wait(300);
                myFinch.setLED(0, 255, 0);
                myFinch.wait(300);
                myFinch.setLED(0, 0, 255);
                myFinch.wait(300);
                myFinch.setLED(255, 255, 255);
                myFinch.wait(300);
                myFinch.setLED(0, 0, 0);

                isConnected = true;
            }
            else
            {
                isConnected = false;
            }

            return(isConnected);
        }
Ejemplo n.º 9
0
        static void DisplayMasterBathroom(Finch finchi)
        {
            DisplayHeader("Master Bathroom");

            string menuChoice;
            string messageMasterBathroom = "";

            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("\t1) Take a bath.");
            Console.WriteLine("\t2) Look in the mirror");
            Console.WriteLine("\t3) Steal the towels.");

            Console.WriteLine("\t4) Back");

            Console.WriteLine();
            Console.Write("Enter Choice");
            menuChoice = Console.ReadLine();


            switch (menuChoice)
            {
            case "1":
                messageMasterBathroom = "Finchi does not think that this is the right time for this.";
                finchi.setLED(0, 255, 0);
                finchi.wait(300);
                finchi.setLED(0, 0, 255);
                finchi.wait(300);
                finchi.setLED(0, 0, 0);
                break;

            case "2":
                messageMasterBathroom = "Say Bloody Mary three times and see what happens! Aw... nothing happened... ";

                break;

            case "3":
                messageMasterBathroom = "Finchi can't take  you anywhere...";

                break;

            case "4":
                DisplaySecondFloor(finchi);
                break;

            default:
                DisplayMasterBathroom(finchi);
                break;
            }

            if (messageMasterBathroom != "")
            {
                Console.Clear();
                Console.WriteLine();
                Console.WriteLine(messageMasterBathroom);
                DisplayContinuePrompt();
                DisplayMasterBathroom(finchi);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Initialize the Finch robot
        /// </summary>
        private static void InitializeFinch(Finch myFinch)
        {
            Console.Clear();

            Console.WriteLine();
            Console.WriteLine("Attempting to connect to the Finch robot.");
            Console.WriteLine();

            myFinch.connect();

            //
            // Audio/visual feedback to user
            //
            for (int increment = 0; increment < 255; increment += 10)
            {
                myFinch.setLED(0, increment, 0);
                //myFinch.noteOn(increment * 100);
                myFinch.wait(200);
            }
            myFinch.setLED(0, 0, 0);
            myFinch.noteOff();

            Console.Clear();

            Console.WriteLine();
            Console.WriteLine("The Finch robot is now connected.");
            Console.WriteLine();

            DisplayContinuePrompt();
        }
Ejemplo n.º 11
0
        //
        // display connect finch robot
        //
        static bool DisplayConnectFinchRobot(Finch finchRobot)
        {
            bool finchRobotConnected = false;

            DisplayScreenHeader("Connect Finch Robot");

            Console.WriteLine("Ready to connect to the Finch Robot. Please be sure to connect the USB cable to the robot and the computer.");
            DisplayContinuePrompt();
            Console.Clear();
            Console.WriteLine();

            finchRobotConnected = finchRobot.connect();

            if (finchRobotConnected)
            {
                finchRobot.setLED(0, 255, 0);
                finchRobot.noteOn(15000);
                finchRobot.wait(250);
                finchRobot.noteOff();
                finchRobot.setLED(0, 0, 0);

                Console.WriteLine();
                Console.WriteLine("Finch robot is now connected.");
            }
            else
            {
                Console.WriteLine();
                Console.WriteLine("Unable to connect to the Finch robot.");
            }

            DisplayContinuePrompt();

            return(finchRobotConnected);
        }
Ejemplo n.º 12
0
        //------------//
        //Display LEDS//
        //------------//
        static void DisplayLeds(Finch myFinch)
        {
            DisplayHeader("Finch LEDs");

            //for (int i = 0; i < 5; i++)
            //{
            //    myFinch.setLED(0, 0, 255);
            //    myFinch.wait(500);
            //    myFinch.setLED(0, 0, 0);
            //    myFinch.wait(500);
            //}
            for (int lightLevel = 0; lightLevel < 255; lightLevel++)
            {
                myFinch.setLED(lightLevel, 0, 0);
                myFinch.wait(10);
            }
            for (int lightLevel = 255; lightLevel > 0; lightLevel--)
            {
                myFinch.setLED(lightLevel, 0, 0);
                myFinch.wait(10);
            }

            DisplayContinuePrompt();
            DisplayTalentShow(myFinch);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// *****************************************************************
        /// *                  Connect the Finch Robot                      *
        /// *****************************************************************
        /// </summary>
        /// <param name="finchRobot">finch robot object</param>
        /// <returns>notify if the robot is connected</returns>
        static bool DisplayConnectFinchRobot(Finch finchRobot)
        {
            Console.CursorVisible = false;

            bool robotConnected;

            DisplayScreenHeader("Connect Finch Robot");

            Console.WriteLine("\tAbout to connect to Finch robot. Please be sure the USB cable is connected to the robot and computer now.");
            DisplayContinuePrompt();

            robotConnected = finchRobot.connect();

            // TODO test connection and provide user feedback - text, lights, sounds
            int red = IsValidInt("Please enter a value bwteen 1-255 to set your red LED and verify connection.");

            finchRobot.setLED(red, 0, 0);
            //  ValidateConnection();

            DisplayMenuPrompt("Main Menu");

            //
            // reset finch robot
            //
            finchRobot.setLED(0, 0, 0);
            finchRobot.noteOff();

            return(robotConnected);
        }
        static void DisplayMixing(Finch myFinch)
        {
            //
            // Display of Finch's functions in mixing
            //
            Console.CursorVisible = false;

            DisplayScreenHeader("Mixing It Up");

            Console.WriteLine("\tThe Finch robot will show off it's moves!");
            DisplayContinuePrompt();
            for (int looptwo = 0; looptwo < 8; looptwo++)
            {
                myFinch.setMotors(150, 150);    // move
                myFinch.wait(200);
                myFinch.setMotors(0, 0);        // stop
                myFinch.setLED(100, 100, 100);  // turn on LEDs
                myFinch.noteOn(450);            // turn on note
                myFinch.wait(200);
                myFinch.noteOff();              // turn off note
                myFinch.setLED(0, 0, 0);        // turn off LEDs
            }


            DisplayMenuPrompt("Talent Show!");
        }
        /// <summary>
        /// *****************************************************************
        /// *               Talent Show > Mixing it Up                    *
        /// *****************************************************************
        /// </summary>
        /// <param name="finchRobot">finch robot object</param>
        static void DisplayMixingItUp(Finch finchRobot)
        {
            Console.CursorVisible = false;

            DisplayScreenHeader("Mixing it up");

            Console.WriteLine("\tThe Finch robot will now move in a square pattern while flashing lights and making noise!");
            DisplayContinuePrompt();

            for (int t = 0; t < 4; t++)
            {
                finchRobot.setMotors(80, 100);
                for (int lightSoundLevel = 0; lightSoundLevel < 100; lightSoundLevel++)
                {
                    finchRobot.setLED(0, lightSoundLevel, lightSoundLevel);
                    finchRobot.noteOn(lightSoundLevel * 50);
                }
                finchRobot.setMotors(0, 100);
                for (int lightSoundLevel = 100; lightSoundLevel > 0; lightSoundLevel--)
                {
                    finchRobot.setLED(lightSoundLevel, lightSoundLevel, lightSoundLevel);
                    finchRobot.noteOn(lightSoundLevel * 50);
                }
                finchRobot.setMotors(0, 0);
            }
            finchRobot.setLED(0, 0, 0);
            finchRobot.noteOn(0);

            DisplayMenuPrompt("Talent Show Menu");
        }
        static void DisplayMusic(Finch myFinch)
        {
            //
            // oh say can you see
            //
            myFinch.setLED(255, 0, 0);
            myFinch.noteOn(700);
            myFinch.wait(500);
            myFinch.noteOn(500);
            myFinch.wait(500);
            myFinch.noteOn(400);
            myFinch.wait(1200);
            myFinch.noteOn(500);
            myFinch.wait(700);
            myFinch.noteOn(600);
            myFinch.wait(700);
            myFinch.noteOn(800);
            myFinch.wait(500);
            myFinch.noteOff();

            //
            // by the dawns early light
            //
            myFinch.setLED(255, 255, 255);
            myFinch.wait(500);
            myFinch.noteOn(1000);
            myFinch.wait(700);
            myFinch.noteOn(900);
            myFinch.wait(500);
            myFinch.noteOn(800);
            myFinch.wait(700);
            myFinch.noteOn(500);
            myFinch.wait(600);
            myFinch.noteOn(550);
            myFinch.wait(600);
            myFinch.noteOn(600);
            myFinch.wait(700);
            myFinch.noteOff();
            myFinch.wait(500);

            //
            // whats so proudly we hailed
            //
            myFinch.setLED(0, 0, 255);
            myFinch.noteOn(600);
            myFinch.wait(700);
            myFinch.noteOn(550);
            myFinch.noteOn(1000);
            myFinch.wait(900);
            myFinch.noteOn(900);
            myFinch.wait(500);
            myFinch.noteOn(800);
            myFinch.wait(500);
            myFinch.noteOn(750);
            myFinch.wait(700);
            myFinch.noteOff();
            myFinch.wait(200);
            myFinch.noteOff();
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            Sam.connect();
            DisplayWelcomeScreen();
            FinchShields shieldLevel = GetUserShieldLevel();
            int          speed       = 0;

            ambientTemperature = GetTempature();

            switch (shieldLevel)
            {
            case FinchShields.HIGH:
                speed = 100;
                break;

            case FinchShields.MEDIUM:
                speed = 75;
                break;

            case FinchShields.LOW:
                speed = 50;
                break;

            default:
                break;
            }

            DisplayContinuePrompt();
            Console.Clear();
            MoveSamForward(speed);
            Console.WriteLine("Super Finch is marching forward into battle!");

            do
            {
                switch (shieldLevel)
                {
                case FinchShields.HIGH:
                    Sam.setLED(0, 255, 0);
                    break;

                case FinchShields.MEDIUM:
                    Sam.setLED(0, 0, 255);
                    break;

                case FinchShields.LOW:
                    Sam.setLED(255, 0, 0);
                    break;

                default:
                    break;
                }

                shieldLevel = HitDetection(shieldLevel);
            } while (shieldLevel != FinchShields.FAILED);

            Sam.setMotors(0, 0);
            Console.WriteLine("Game Over!");
            DisplayContinuePrompt();
        }
Ejemplo n.º 18
0
        static void ExecuteCommands()
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Execute Commands");
            Console.WriteLine();
            Console.WriteLine();

            DisplayContinuePrompt();

            foreach (FinchCommand command in commands)
            {
                switch (command)
                {
                case FinchCommand.DONE:
                    break;

                case FinchCommand.MOVEFORWARD:
                    Console.WriteLine("Now moving forward.");
                    myFinch.setMotors(motorSpeed, motorSpeed);
                    break;

                case FinchCommand.MOVEBACKWARD:
                    Console.WriteLine("Now moving backward.");
                    myFinch.setMotors(-motorSpeed, -motorSpeed);
                    break;

                case FinchCommand.STOPMOTORS:
                    myFinch.setMotors(0, 0);
                    break;

                case FinchCommand.DELAY:
                    myFinch.wait(delayDuration);
                    break;

                case FinchCommand.TURNRIGHT:
                    myFinch.setMotors(motorSpeed, -motorSpeed);
                    break;

                case FinchCommand.TURNLEFT:
                    myFinch.setMotors(-motorSpeed, motorSpeed);
                    break;

                case FinchCommand.LEDON:
                    myFinch.setLED(LEDBrightness, LEDBrightness, LEDBrightness);
                    break;

                case FinchCommand.LEDOFF:
                    myFinch.setLED(0, 0, 0);
                    break;

                default:
                    break;
                }
            }

            DisplayContinuePrompt();
        }
Ejemplo n.º 19
0
 //
 //Finch is angry
 //
 private static void AngryFinch(Finch myFinch)
 {
     myFinch.setLED(255, 0, 0);
     myFinch.noteOn(500);
     myFinch.wait(1000);
     myFinch.noteOff();
     myFinch.setLED(0, 0, 255);
 }
Ejemplo n.º 20
0
        static void DisplayKitchen(Finch finchi)
        {
            DisplayHeader("Kitchen");

            string menuChoice;
            string messageKitchen = "";

            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("\t1) Check inside the icebox.");
            Console.WriteLine("\t2) Look in the cupboards.");
            Console.WriteLine("\t3) Eat the fruit on the table.");

            Console.WriteLine("\t4) Back");

            Console.WriteLine();
            Console.Write("Enter Choice");
            menuChoice = Console.ReadLine();


            switch (menuChoice)
            {
            case "1":
                messageKitchen = "Doesn't look like there has been any ice in here in a long time...";
                break;

            case "2":
                messageKitchen = "Just a bunch of broken plates and cups.";
                break;

            case "3":
                messageKitchen = "It's not real! Its plastic apples. Ew!";
                finchi.setMotors(-200, -200);
                finchi.setLED(255, 0, 0);
                finchi.wait(500);
                finchi.setMotors(0, 0);
                finchi.setLED(0, 0, 0);
                break;

            case "4":
                DisplayFirstFloor(finchi);
                break;

            default:
                DisplayKitchen(finchi);
                break;
            }

            if (messageKitchen != "")
            {
                Console.Clear();
                Console.WriteLine();
                Console.WriteLine(messageKitchen);
                DisplayContinuePrompt();
                DisplayKitchen(finchi);
            }
        }
Ejemplo n.º 21
0
 static void TemperatureNominalIndicator(Finch finch)
 {
     finch.setLED(0, 255, 0);
     finch.wait(500);
     Console.WriteLine($"Current Temperature: {finch.getTemperature()}");
     Console.WriteLine($"Current Light Level: {(finch.getLeftLightSensor() + finch.getRightLightSensor()) / 2}");
     finch.setLED(0, 0, 0);
     finch.wait(500);
 }
        /// <summary>
        /// *****************************************************************
        /// *               Talent Show > Light and Sound                   *
        /// *****************************************************************
        /// </summary>
        /// <param name="finchRobot">finch robot object</param>
        static void DisplayLightAndSound(Finch finchRobot)

        {
            Console.CursorVisible = false;

            DisplayScreenHeader("Light and Sound");

            Console.WriteLine("\tThe Finch robot will not show off its glowing talent!");
            DisplayContinuePrompt();

            for (int lightSoundLevel = 0; lightSoundLevel < 210; lightSoundLevel++)
            {
                finchRobot.setLED(lightSoundLevel, lightSoundLevel, lightSoundLevel);
                finchRobot.noteOn(lightSoundLevel * 75);
            }
ColorSelecton:
            Console.WriteLine("What color would you like to see red , blue or green?");
            string userColorResponse = Console.ReadLine();

            if (userColorResponse == "red")
            {
                finchRobot.setLED(255, 0, 0);
            }
            else if (userColorResponse == "green")
            {
                finchRobot.setLED(0, 255, 0);
            }
            else if (userColorResponse == "blue")
            {
                finchRobot.setLED(0, 0, 255);
            }
            else
            {
                Console.WriteLine("You did not select one of those colors");
                goto ColorSelecton;
            }
LowOrHigh:
            Console.WriteLine("Would you like to hear high or low noise?");
            string userNoiseResponse = Console.ReadLine();

            if (userNoiseResponse == "high")
            {
                finchRobot.noteOn(3000);
            }
            else if (userNoiseResponse == "low")
            {
                finchRobot.noteOn(500);
            }
            else
            {
                Console.WriteLine("Please select a low or high frequency");
                goto LowOrHigh;
            }
            Console.WriteLine("Those are my light and sound talents.");
            DisplayMenuPrompt("Talent Show Menu");
            finchRobot.noteOff();
        }
Ejemplo n.º 23
0
        static void DisplayExecuteFinchCommands(FinchCommand[] commands, Finch finch, int motorSpeed, int LEDBrightness, int delayDuration)
        {
            DisplayHeader("Execute Finch Commands");

            Console.WriteLine("Press any key to execute commands...");
            Console.ReadKey();

            for (int i = 0; i < commands.Length; i++)
            {
                Console.WriteLine($"Command {i+1}/{commands.Length}: {commands[i]}");

                switch (commands[i])
                {
                case FinchCommand.DONE:
                    finch.disConnect();
                    break;

                case FinchCommand.MOVEFORWARD:
                    finch.setMotors(motorSpeed, motorSpeed);
                    break;

                case FinchCommand.MOVEBACKWARD:
                    finch.setMotors(-motorSpeed, -motorSpeed);
                    break;

                case FinchCommand.STOPMOTORS:
                    finch.setMotors(0, 0);
                    break;

                case FinchCommand.DELAY:
                    finch.wait(delayDuration);
                    break;

                case FinchCommand.TURNRIGHT:
                    finch.setMotors(motorSpeed, motorSpeed / 2);
                    break;

                case FinchCommand.TURNLEFT:
                    finch.setMotors(motorSpeed, motorSpeed / 2);
                    break;

                case FinchCommand.LEDON:
                    finch.setLED(LEDBrightness, LEDBrightness, LEDBrightness);
                    break;

                case FinchCommand.LEDOFF:
                    finch.setLED(0, 0, 0);
                    break;

                default:
                    Console.WriteLine("Function non-existent");
                    break;
                }
            }

            DisplayContinuePrompt();
        }
Ejemplo n.º 24
0
        static void DisplayExecuteFinchCommands(Finch myFinch, FinchCommand[] commands, int motorSpeed, int lEDBrightness, int delayDuration)
        {
            DisplayHeader("Execute Finch Commands");

            Console.WriteLine("Press any key when ready to execute commands.");
            DisplayContinuePrompt();

            for (int index = 0; index < commands.Length; index++)
            {
                Console.WriteLine($"Command: {commands[index]}");

                switch (commands[index])
                {
                case FinchCommand.DONE:
                    break;

                case FinchCommand.MOVEFORWARD:
                    myFinch.setMotors(motorSpeed, motorSpeed);
                    break;

                case FinchCommand.MOVEBACKWARD:
                    myFinch.setMotors(-motorSpeed, -motorSpeed);
                    break;

                case FinchCommand.STOPMOTORS:
                    myFinch.setMotors(0, 0);
                    break;

                case FinchCommand.DELAY:
                    myFinch.wait(delayDuration);
                    break;

                case FinchCommand.TURNRIGHT:
                    myFinch.setMotors(motorSpeed, -motorSpeed);
                    break;

                case FinchCommand.TURNLEFT:
                    myFinch.setMotors(-motorSpeed, motorSpeed);
                    break;

                case FinchCommand.LEDON:
                    myFinch.setLED(lEDBrightness, lEDBrightness, lEDBrightness);
                    break;

                case FinchCommand.LEDOFF:
                    myFinch.setLED(0, 0, 0);
                    break;

                default:

                    break;
                }
            }

            DisplayContinuePrompt();
        }
Ejemplo n.º 25
0
        static void DisplaySittingRoom(Finch finchi)
        {
            DisplayHeader("Sitting Room");

            string menuChoice;
            string messageSittingRoom = "";

            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("\t1) Sit on the couch.");
            Console.WriteLine("\t2) Turn on the lamp.");
            Console.WriteLine("\t3) Check out the bookshelf.");

            Console.WriteLine("\t4) Back");

            Console.WriteLine();
            Console.Write("Enter Choice");
            menuChoice = Console.ReadLine();


            switch (menuChoice)
            {
            case "1":
                messageSittingRoom = "The couch doesn't seem very comfortable. It looks like there are small rodents living in it.";
                break;

            case "2":
                messageSittingRoom = "There isn't any power in the place. Finchi will light the way.";
                finchi.setLED(255, 255, 255);
                finchi.wait(200);
                finchi.setLED(0, 0, 0);
                break;

            case "3":
                messageSittingRoom = "Aww... There isn't a hidden passage behind it. Just the complete collection of the 1954 edtion of the Encyclopedia Britannica.";
                break;

            case "4":
                DisplayFirstFloor(finchi);
                break;

            default:
                DisplaySittingRoom(finchi);
                break;
            }

            if (messageSittingRoom != "")
            {
                Console.Clear();
                Console.WriteLine();
                Console.WriteLine(messageSittingRoom);
                DisplayContinuePrompt();
                DisplaySittingRoom(finchi);
            }
        }
Ejemplo n.º 26
0
        //******************
        // ROOM CODE BLOCKS
        //******************

        static void DisplayDiningRoom(Finch finchi)
        {
            DisplayHeader("Dining Room");

            string menuChoice;
            string messageDiningRoom = "";

            Console.WriteLine();
            Console.WriteLine();

            Console.WriteLine("\t1) Check inside the china cabinet.");
            Console.WriteLine("\t2) Look under the table.");
            Console.WriteLine("\t3) Avoid the shadowy corner.");

            Console.WriteLine("\t4) Back");

            Console.WriteLine();
            Console.Write("Enter Choice");
            menuChoice = Console.ReadLine();


            switch (menuChoice)
            {
            case "1":
                messageDiningRoom = "There is a mouse in there! Scary!";
                break;

            case "2":
                messageDiningRoom = "Just a bunch of dust bunnies.";
                break;

            case "3":
                messageDiningRoom = "It's really dark over there. Finchi will light the way.";
                finchi.setLED(255, 255, 255);
                finchi.wait(200);
                finchi.setLED(0, 0, 0);
                break;

            case "4":
                DisplayFirstFloor(finchi);
                break;

            default:
                DisplayDiningRoom(finchi);
                break;
            }

            if (messageDiningRoom != "")
            {
                Console.Clear();
                Console.WriteLine();
                Console.WriteLine(messageDiningRoom);
                DisplayContinuePrompt();
                DisplayDiningRoom(finchi);
            }
        }
Ejemplo n.º 27
0
        private static void DisplayExicuteFinchCommands(Finch myFinch, List <FinchCommand> commands, int delayDuration, int motorSpeed, int lEDBrightness)
        {
            DisplayHeader("Execute Finch Commands");

            Console.WriteLine("Press any key to execute commands");
            Console.ReadKey();

            for (int i = 0; i < commands.Count; i++)
            {
                Console.WriteLine("Command : " + commands[i]);

                switch (commands[i])
                {
                case FinchCommand.DONE:
                    break;

                case FinchCommand.MOVEFORWARD:
                    myFinch.setMotors(motorSpeed, motorSpeed);
                    break;

                case FinchCommand.MOVEBACKWARD:
                    myFinch.setMotors(-motorSpeed, -motorSpeed);
                    break;

                case FinchCommand.STOPMOTORS:
                    myFinch.setMotors(0, 0);
                    break;

                case FinchCommand.DELAY:
                    myFinch.wait(delayDuration);
                    break;

                case FinchCommand.TURNRIGHT:
                    myFinch.setMotors(motorSpeed, (motorSpeed / 2));
                    break;

                case FinchCommand.TURNLEFT:
                    myFinch.setMotors((motorSpeed / 2), motorSpeed);
                    break;

                case FinchCommand.LEDON:
                    myFinch.setLED(lEDBrightness, lEDBrightness, lEDBrightness);
                    break;

                case FinchCommand.LEDOFF:
                    myFinch.setLED(0, 0, 0);
                    break;

                default:
                    break;
                }
            }


            DisplayContinuePrompt();
        }
Ejemplo n.º 28
0
 static void DisplayWin(Finch edi)
 {
     edi.setLED(0, 255, 0);
     edi.noteOn(150);
     edi.wait(3000);
     edi.setLED(0, 0, 0);
     edi.noteOff();
     Console.WriteLine("You win!");
     Console.ReadKey();
 }
Ejemplo n.º 29
0
        static void DisplayExecuteFinchCommands(Finch finchRobot, List <String> commands, int motorSpeed, int ledBrightness, double waitSeconds)
        {
            DisplayScreenHeader("Execute Commands");
            Console.WriteLine("Will execute all specified commands");

            foreach (var userCommand in commands)
            {
                if (userCommand == "MOVEFORWARD")
                {
                    Console.WriteLine("Moving forwards\n");
                    finchRobot.setMotors(motorSpeed, motorSpeed);
                }
                else if (userCommand == "MOVEBACKWARD")
                {
                    Console.WriteLine("Moving backwards\n");
                    finchRobot.setMotors(motorSpeed - (motorSpeed * 2), motorSpeed - (motorSpeed * 2));
                }
                else if (userCommand == "STOPMOTORS")
                {
                    Console.WriteLine("Stopping\n");
                    finchRobot.setMotors(0, 0);
                }
                else if (userCommand == "WAIT")
                {
                    Console.WriteLine("Waiting\n");
                    finchRobot.wait(Convert.ToInt32(waitSeconds));
                }
                else if (userCommand == "TURNRIGHT")
                {
                    Console.WriteLine("Turning right\n");
                    finchRobot.setMotors(motorSpeed, 0);
                }
                else if (userCommand == "TURNLEFT")
                {
                    Console.WriteLine("Turning left\n");
                    finchRobot.setMotors(0, motorSpeed);
                }
                else if (userCommand == "LEDON")
                {
                    Console.WriteLine("Turning LED on\n");
                    finchRobot.setLED(ledBrightness, ledBrightness, ledBrightness);
                }
                else if (userCommand == "LEDOFF")
                {
                    Console.WriteLine("Turning LED off\n");
                    finchRobot.setLED(0, 0, 0);
                }
                else if (userCommand == "GETTEMPERATURE")
                {
                    Console.WriteLine("Getting temperature\n");
                    Console.WriteLine($"Temperature (C): {0}\n", finchRobot.getTemperature());
                }
            }
            DisplayContinuePrompt();
        }
        static void ExploreLeds(Finch finchRobot)
        {
            for (int ledValue = 0; ledValue < 255; ledValue = ledValue + 5)
            {
                finchRobot.setLED(ledValue, ledValue, ledValue);
                finchRobot.wait(10);
            }

            finchRobot.setLED(255, 0, 0);
            finchRobot.wait(500);
            finchRobot.setLED(255, 100, 0);
            finchRobot.wait(500);
            finchRobot.setLED(255, 240, 0);
            finchRobot.wait(500);
            finchRobot.setLED(100, 255, 0);
            finchRobot.wait(500);
            finchRobot.setLED(0, 255, 225);
            finchRobot.wait(500);
            finchRobot.setLED(0, 0, 255);
            finchRobot.wait(500);
            finchRobot.setLED(255, 0, 255);
            finchRobot.wait(500);
            finchRobot.setLED(0, 0, 0);


            Console.Clear();
            DisplayContinuePrompt();
        }