Exemplo n.º 1
0
        //author: Eric Grant
        //title: Tell Me About It
        //description:
        //date: 10-11-1017

        static void Main(string[] args)
        {
            //instantiate finch
            //
            Finch tim          = new Finch();
            bool  timConnected = tim.connect();

            //main app vars
            //
            int userChoice = 0;

            //main app loop
            //
            DisplayStartScreen(timConnected);

            DisplayGreenSelectAndSet(tim);

            do
            {
                userChoice = DisplayMainMenu();
                DecideAction(userChoice, tim);
            } while (userChoice != 7);

            DisplayEndScreen(tim);

            //diconnect finch
            //
            tim.disConnect();
        }
        /// <summary>
        /// *****************************************************************
        /// *               Disconnect the Finch Robot                      *
        /// *****************************************************************
        /// </summary>
        /// <param name="myFinch">finch robot object</param>
        static void DisplayDisconnectFinchRobot(Finch myFinch)
        {

            Console.CursorVisible = false;

            bool robotConnected;

            DisplayScreenHeader("Disconnect Finch Robot");

            Console.WriteLine("\tAbout to disconnect from the Finch robot.");
            DisplayContinuePrompt();

            robotConnected = myFinch.connect();

            if (robotConnected)
            { 
                myFinch.disConnect();
                Console.WriteLine("\tThe Finch robot is disconnected.");
            }
            else
            {
                Console.WriteLine("\tThe Finch robot is already disconnected.");
            }

            DisplayMenuPrompt("Main Menu");
        }
Exemplo n.º 3
0
    /// <summary>
    /// *****************************************************************
    /// *               Talent Show > movement                  *
    /// *****************************************************************
    /// </summary>
    /// <param name="finchRobot">finch robot object</param>

    static void DisplayFinchMovement(Finch finchRobot)
    {
        string userResponse;
        int    leftSpeed;
        int    rightSpeed;

        Console.CursorVisible = false;

        DisplayScreenHeader("movement");

        Console.WriteLine("\t how fast do you want the left wheel to go? (please answer from a speed rating of 1-255)");
        Console.WriteLine();
        userResponse = Console.ReadLine();
        leftSpeed    = int.Parse(userResponse);

        Console.WriteLine("\t Now lets set the speed for the right wheel?(please answer from a speed rating of 1-255)");
        Console.WriteLine();
        userResponse = Console.ReadLine();
        rightSpeed   = int.Parse(userResponse);

        DisplayContinuePrompt();

        int leftMotor  = leftSpeed;
        int rightMotor = rightSpeed;

        finchRobot.setMotors(leftMotor, rightMotor);

        Console.WriteLine(" Press any key to disconnet Robot");
        Console.ReadKey();
        finchRobot.disConnect();

        DisplayMenuPrompt("Talent Show Menu");
    }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
0
        //------------------------------------------------------------------//
        // Application:Finch Assignments                                    //
        // Author:Sean Donovan                                              //
        // Description:Coding assingments within Mission 3                  //
        // Date Created:2/27/2020                                           //
        // Last Date Edited:03/04/2020                                      //
        //------------------------------------------------------------------//

        #region Prcedure
        //----//
        //Main//
        //----//
        static void Main(string[] args)
        {
            //-------------//
            // create Finch//
            //-------------//
            Finch myFinch;

            myFinch = new Finch();

            //-----------------//
            // connect to finch//
            //-----------------//
            myFinch.connect();

            //-------//
            //Process//
            //-------//
            DisplayWelcomeScreen();
            DisplayMainMenu(myFinch);
            DisplayClosingScreen();

            //----------------------//
            // disconnect from finch//
            //----------------------//
            myFinch.disConnect();
        }
Exemplo n.º 6
0
        // *************************************************************
        // Application:     Finch Control

        // Author:          Hailey McGuire
        // Description:     Finch Starter - Talent Show
        // Application Type: Console
        // Date Created:    02/09/2021
        // Date Revised:    02/20/2021
        // *************************************************************

        static void Main(string[] args)
        {
            //
            // create a new Finch object
            //
            Finch myFinch;

            myFinch = new Finch();

            //
            // call the connect method
            //
            myFinch.connect();

            //
            // begin your code
            //

            MainAppTheme();

            DisplayWelcomeScreen();

            MainMenu();

            DisplayClosingScreen();

            //
            // call the disconnect method
            //
            myFinch.disConnect();
        }
Exemplo n.º 7
0
 static void DisplayClosingScreen(Finch Donnie)
 {
     Console.Clear();
     Donnie.disConnect();
     Console.WriteLine();
     Console.WriteLine("\t\tGoodbye");
     Console.ReadLine();
 }
Exemplo n.º 8
0
        /// <summary>
        /// Disconnect and close
        /// </summary>
        /// <param name="finchRobot"></param>
        static void Disconnect(Finch finchRobot)
        {
            finchRobot.disConnect();

            Console.WriteLine("\tThe Finch robot is now disconnected.");
            Console.WriteLine();
            Console.WriteLine("Thank you for using my application!");
            Continue();
        }
Exemplo n.º 9
0
        /// <summary>
        /// display end screen
        /// </summary>
        static void DisplayEndScreen(Finch tim)
        {
            tim.disConnect();
            PrintHeader("End Screen");

            Console.WriteLine("Later nerd.");

            DisplayAnyKey();
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
0
        // Displaying menu
        static void DisplayMenu()
        {
            string decision;

            Console.WriteLine();
            Console.WriteLine("MENU");
            Console.WriteLine();
            Console.WriteLine("Type USA for a patriotic light and movement show");
            Console.WriteLine("Type RAINBOW for a rainbow light and movement show");
            Console.WriteLine("Type SURPRISE for a surprise light and movement show");
            Console.WriteLine("Type 'QUIT' to quit");
            Console.WriteLine();
            decision = Console.ReadLine().ToUpper();

            // users type the show they want or quit
            // once the users type this, the switch statement will call the required method

            Finch cappy = new Finch();

            cappy.connect();

            switch (decision)
            {
            case "USA":

                DisplayPatrioticShow(cappy);

                break;

            case "RAINBOW":

                DisplayRainbowShow(cappy);

                break;

            case "SURPRISE":

                DisplaySurpriseShow(cappy);

                break;

            case "QUIT":

                DisplayClosingScreen();
                cappy.disConnect();
                break;

            default:
                Console.Clear();
                Console.WriteLine("Please enter a correct value.");
                DisplayMenu();
                break;

                // if the users type something the code will not accept, it will clear the screen and tell the user to enter a correct value
            }
        }
Exemplo n.º 12
0
        static void DisplayTerminateFinch(Finch myFinch)
        {
            Console.WriteLine("Press any key to terminate finch.");
            Console.ReadKey();

            myFinch.noteOn(800);
            myFinch.wait(500);
            myFinch.noteOff();
            myFinch.disConnect();
        }
Exemplo n.º 13
0
        /// <summary>
        /// How we disconnect the Finchy
        /// </summary>
        /// <param name="Reznor"></param>
        //RUSSELL YOU CHANGED BOOL TO VOID ON DISPLAYDISCONNECTFINCHROBOT
        static void DisplayDisconnectFinchRobot(Finch Reznor)
        {
            DisplayHeader("Disconnect Finch Robot named Reznor");

            Console.WriteLine("Done already!? Well Reznor will disconnect now. Please be patient!");
            Reznor.disConnect();
            Console.WriteLine("Our Finch friend Reznor has been disconnected.");

            DisplayContinuePromt();
        }
Exemplo n.º 14
0
        static void DisplayMenu(Finch tim)
        {
            bool       breaking = false;
            bool       setup = false;
            double     ambientTemp = 0, tolerance = 0;
            int        ambientLight = 0;
            string     uInput;
            MenuOption uInputAsEnum;

            while (!breaking)
            {
                GD.DisplayNewScreen("Main Menu");
                Console.WriteLine("Select Option:");
                foreach (MenuOption option in Enum.GetValues(typeof(MenuOption)))
                {
                    Console.WriteLine(option);
                }

                do
                {
                    Console.Write(">");
                    uInput = GI.GetString(true);
                } while (!Enum.TryParse <MenuOption>(uInput, out uInputAsEnum));

                switch (uInputAsEnum)
                {
                case MenuOption.SETUP:
                    tolerance = DisplaySetupTim(tim, out ambientTemp, out ambientLight);
                    setup     = true;
                    break;

                case MenuOption.ACTIVATE:
                    if (setup)
                    {
                        DisplayActivateTim(tim, tolerance, ambientTemp, ambientLight);
                    }
                    else
                    {
                        Console.WriteLine("Please run setup first.");
                        GD.DisplayAnyKey();
                    }

                    break;

                case MenuOption.EXIT:
                    breaking = true;
                    break;

                default:
                    break;
                }
            }
            tim.disConnect();
        }
        /// <summary>
        /// Terminate Connection
        /// </summary>
        static void TerminateFinch()
        {
            Console.ForegroundColor = ConsoleColor.Red;
            DisplayHeader("Terminate Finch");

            myFinch.disConnect();

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

            DisplayContinuePrompt();
        }
Exemplo n.º 16
0
 static void DisplayClosingScreen(Finch edi)
 {
     Console.Clear();
     Console.WriteLine();
     Console.WriteLine("\t\tThank you for using my app.");
     Console.WriteLine();
     Console.WriteLine("\tPress any key to exit, have a nice day.");
     Console.ReadKey();
     edi.disConnect();
     Environment.Exit(0);
 }
Exemplo n.º 17
0
        /// <summary>
        /// Closing Screen:  Thanks the user for using the application and disconnects the Finch.
        /// </summary>
        /// <param name="closingText"></param>
        /// <param name="myFinch"></param>
        static void DisplayClosingScreen(string closingText, Finch myFinch)
        {
            Console.Clear();
            Console.WriteLine("\t***************[Goodbye!]*****************");
            Console.WriteLine();
            Console.WriteLine("\tThank you, {0}, for using this application!", closingText);
            Console.WriteLine();
            Console.WriteLine("\tPress any key to end the application {0}.", closingText);
            Console.ReadKey();

            myFinch.disConnect();
        }
Exemplo n.º 18
0
        /// <summary>
        /// display closing screen and disconnect finch robot
        /// </summary>
        /// <param name="myFinch">Finch object</param>
        static void DisplayClosingScreen(Finch myFinch)
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("\t\tThank You!");
            Console.WriteLine();

            myFinch.disConnect();

            DisplayContinuePrompt();
        }
Exemplo n.º 19
0
        /// <summary>
        /// display closing screen
        /// </summary>
        static void DisplayClosingScreen()
        {
            DisplayHeader("End Screen");

            tim.setLED(100, 100, 100);
            tim.disConnect();

            Console.WriteLine("Later nerd.");

            Console.WriteLine("\nPress any key to exit.");
            Console.ReadKey();
        }
Exemplo n.º 20
0
 static void DisplayClosingScreen()
 {
     //
     // Song time is over, disconnect Finch
     //
     Console.WriteLine();
     Console.WriteLine("Thank you for playing Karaoke Finch!");
     gloria.disConnect();
     Console.WriteLine();
     Console.WriteLine("Press any key to continue.");
     Console.ReadKey();
 }
Exemplo n.º 21
0
        static void DisplayMainMenu()
        {
            bool   runApplication = true;
            string userMenuChoice;
            Finch  alma = new Finch();

            while (runApplication)
            {
                DisplayHeader("Main Menu");

                //
                // display menu
                //
                Console.WriteLine("A) Avoid  Obstacles Finch will Avoid  an object)");
                Console.WriteLine("B) Avoid  the Tracking Light (Finch will Avoid  a bright light a flashlight while trying to move forwards)");
                Console.WriteLine("C) Avoid  Obstacles and the Tracking light");
                Console.WriteLine("Q) Quit");
                Console.WriteLine();
                Console.Write("Enter Menu Choice:");
                userMenuChoice = Console.ReadLine().ToUpper();

                //
                // process menu choice
                //
                switch (userMenuChoice)
                {
                case "A":
                    advoidobstacles(alma);
                    break;

                case "B":
                    AdvoidLight(alma);
                    break;

                case "C":
                    AdvoidLightAndObsticales(alma);
                    break;

                case "Q":
                    runApplication = false;
                    alma.disConnect();
                    break;

                default:
                    Console.WriteLine();
                    Console.WriteLine("Please enter a correct menu choice.");

                    DisplayContinuePrompt();
                    break;
                }
            }
        }
        /// <summary>
        /// display closing screen
        /// </summary>
        static void DisplayClosingScreen(Finch freddy)
        {
            Console.Clear();

            freddy.disConnect();

            Console.WriteLine();
            Console.WriteLine("\t\tThanks for using the Finch Recorder App");
            Console.WriteLine();

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Exemplo n.º 23
0
        /// <summary>
        /// display disconnecting from the Finch robot
        /// </summary>
        /// <param name="finchRobot"></param>
        static void DisplayDisconnectFinchRobot(Finch finchRobot)
        {
            DisplayScreenHeader("Disconnect the Finch Robot");

            Console.WriteLine("The Finch robot is about to be disconnected.");
            DisplayContinuePrompt();

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

            DisplayContinuePrompt();
        }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            Finch tim = InstantiateTim();

            GD.DisplayOpenScreen("Sentry Finch", "tim will detect light and temp levels", new string[1] {
                "Eric Grant"
            });
            DisplayMenu(tim);
            tim.disConnect();
            GD.DisplayCloseScreen("Sentry Finch", new string[1] {
                "Eric Grant"
            });
        }
Exemplo n.º 25
0
        private static void AdvoidLightAndObsticales(Finch alma)
        {
            alma.connect();
            int light;
            int lightThreshold = 8;



            DisplayHeader("Finch flees before the spotlight");
            Console.WriteLine("Finch will Avoid the spotlight (flashlight) for 10 seconds. The Finch will also Avoid  Obsitacls");

            light = alma.getRightLightSensor();

            for (int i = 0; i < 17; i++)
            {
                alma.setMotors(100, 100);
                alma.setLED(0, 255, 0);
                alma.wait(500);

                //
                //avoid light
                //
                if ((lightThreshold + light) < alma.getRightLightSensor())
                {
                    alma.setMotors(255, 0);
                    alma.setLED(255, 0, 0);
                    alma.wait(500);
                    alma.setMotors(255, 255);
                    alma.setLED(255, 0, 0);
                    alma.wait(1500);
                    alma.setMotors(0, 255);
                    alma.setLED(255, 0, 0);
                    alma.wait(500);
                }
                if (alma.isObstacleLeftSide())
                {
                    alma.setMotors(0, 255);
                    alma.setLED(255, 0, 0);
                    alma.wait(500);
                }

                else if (alma.isObstacleRightSide())
                {
                    alma.setMotors(255, 0);
                    alma.setLED(255, 0, 0);
                }
            }
            alma.disConnect();
            DisplayContinuePrompt();
        }
Exemplo n.º 26
0
        static void Menu()
        {
            Finch myFinch = new Finch();

            bool   keepGoing = true;
            string menuChoice;
            double lowerTempThreshold  = 0;
            double upperLightThreshold = 0;

            Console.WriteLine("Welcome To The SentryBot Program");
            Pause();
            Console.Clear();

            while (keepGoing == true)
            {
                Console.WriteLine("SentryBot Menu");
                Console.WriteLine();
                Console.WriteLine("1: Set Up SentryBot");
                Console.WriteLine("2: Activate SentryBot");
                Console.WriteLine("E: Exit");
                menuChoice = Console.ReadLine();

                switch (menuChoice)
                {
                case "1":
                    lowerTempThreshold  = SetupTemp(myFinch);
                    upperLightThreshold = SetupLight(myFinch);
                    Console.Clear();
                    break;

                case "2":
                    ActivateSentryBot(lowerTempThreshold, upperLightThreshold, myFinch);
                    break;

                case "E":
                case "e":
                    keepGoing = false;
                    Console.WriteLine("Thank You For Using The Application");
                    Pause();
                    myFinch.disConnect();
                    break;

                default:
                    Console.WriteLine("Please Enter A Valid Menu Choice");
                    Pause();
                    Console.Clear();
                    break;
                }
            }
        }
Exemplo n.º 27
0
        static void DisplayMenu()
        {
            string menuChoice;
            bool   exiting = false;
            Finch  myfinch = new Finch();

            myfinch.connect();
            double lowerTempThreshold  = 0;
            double lowerLightThreshold = 0;


            while (!exiting)
            {
                DisplayHeader("Main Menu");

                Console.WriteLine("1)Setup");
                Console.WriteLine("2)Activate Sentry Bot");
                Console.WriteLine("3) Light Threshold");
                Console.WriteLine("E) Exit");
                Console.WriteLine();
                Console.WriteLine("Enter Menu Choice");
                menuChoice = Console.ReadLine();

                switch (menuChoice)
                {
                case "1":
                    lowerTempThreshold = DisplaySetup(myfinch, out lowerLightThreshold);
                    break;

                case "2":
                    DisplayActivateSentrybot(lowerTempThreshold, myfinch, lowerLightThreshold);
                    break;

                case "3":

                    break;

                case "E":
                case "e":
                    exiting = true;
                    myfinch.disConnect();
                    break;

                default:
                    Console.WriteLine("Please enter a valid menu choice.");
                    DisplayContinuePrompt();
                    break;
                }
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// display disconect the Finch
        /// </summary>
        /// <param name="myFinch"></param>
        private static void DisconnectTheFinch(Finch myFinch)
        {
            for (int i = 0; i < 3; i++)
            {
                myFinch.setLED(255, 0, 0);
                myFinch.wait(250);
                myFinch.setLED(0, 0, 0);
                myFinch.wait(250);
            }

            myFinch.disConnect();

            Console.WriteLine("The Finch is disconnected");
        }
        // Disconnect the Finch
        static void DisplayDisconnectFinchRobot(Finch finchRobot)
        {
            Console.CursorVisible = false;

            DisplayScreenHeader("Disconnect Finch Robot");

            Console.WriteLine("\tAbout to disconnect from the Finch robot.");
            DisplayContinuePrompt();

            finchRobot.disConnect();

            Console.WriteLine("\tThe Finch robot is now disconnect.");

            DisplayMenuPrompt("Main");
        }
Exemplo n.º 30
0
        static void DisplayDisconnectFinchRobot(Finch finchRobot)
        {
            DisplayScreenHeader("Disconnect Finch Robot");

            Console.WriteLine("\tDisconnecting from the Finch robot.");
            DisplayContinuePrompt();

            finchRobot.disConnect();

            Console.WriteLine();
            Console.WriteLine("\tThe Finch robot is now disconnected.");
            DisplayContinuePrompt();

            MainMenu();
        }
Exemplo n.º 31
0
        static void Main(string[] args)
        {
            //
            // declare the Finch variable and create (instantiate) a new Finch object
            //
            Finch myFinch;
            myFinch = new Finch();

            //
            // connect to the Finch robot
            //
            myFinch.connect();

            //
            // pause the console window before exiting
            //
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();

            //
            // disconnect from the Finch robot
            //
            myFinch.disConnect();
        }