示例#1
0
 /// <summary>
 /// Executes finch commands
 /// </summary>
 static void DisplayExecuteFinchCommands(
     Finch finchRobot,
     List<Command> commands,
     (int motorSpeed, int ledBrightness, int waitSeconds) CommandParameters)
示例#2
0
        /// <summary>
        /// module: Talent Show
        /// </summary>
        static void TalentShow(Finch finchRobot)
        {
            string userResponse;
            DisplayScreenHeader("Talent Show");

            Console.WriteLine("The Finch robot will now show its talent.");
            DisplayContinuePrompt();

            for (int i = 0; i < 255; i++)
            {
                finchRobot.setLED(0, i, 0);
                finchRobot.noteOn(i * 100);
                finchRobot.setMotors(i, i);
            }

            finchRobot.setLED(0, 255, 0);
            finchRobot.setMotors(-100, -100);
            finchRobot.wait(1000);
            RobotStopAll(finchRobot);
            finchRobot.wait(1000);

            finchRobot.setLED(0, 0, 255);
            finchRobot.setMotors(100, 100);
            finchRobot.wait(1000);
            RobotStopAll(finchRobot);
            finchRobot.wait(1000);

            finchRobot.setLED(255, 50, 255);
            finchRobot.setMotors(-255, -255);
            finchRobot.wait(1000);
            RobotStopAll(finchRobot);
            finchRobot.wait(1000);



            RobotStopAll(finchRobot);
            finchRobot.wait(1000);

            finchRobot.setMotors(50, 255);
            finchRobot.wait(500);
            finchRobot.setMotors(-50, -255);
            finchRobot.wait(500);

            finchRobot.setMotors(255, 50);
            finchRobot.wait(500);
            finchRobot.setMotors(-255, -50);
            finchRobot.wait(500);
            RobotStopAll(finchRobot);

            Console.WriteLine();
            do
            {
                Console.WriteLine("Would you like to hear a song?");
                userResponse = Console.ReadLine().ToLower();
                if (userResponse == "yes")
                {
                    Console.WriteLine();
                    Console.WriteLine("That is too bad because I can't find anything on the internet that breaks songs down to simple frequencies");
                    Console.WriteLine("Also, I have no talent so I can't make a song, here is a bunch of beeps though.");
                    PlaySong(finchRobot);
                }

                else if (userResponse == "no")
                {
                    Console.WriteLine("Wow, you upset the Finch.");
                }

                else
                {
                    Console.WriteLine($"I don't understand what {userResponse} means, please answer yes or no");
                    userResponse = "retry";
                }
            } while (userResponse == "retry");

            Console.WriteLine();
            Console.WriteLine("That's all folks.");
            DisplayContinuePrompt();
        }
示例#3
0
        /// <summary>
        /// Display Main Menu
        /// </summary>
        static void DisplayMenu()
        {
            //
            // instantiate a Finch object
            //
            Finch finchRobot = new Finch();

            bool finchRobotConnected = false;
            bool quitApplication = false;
            string menuChoice;

            do
            {
                DisplayScreenHeader("Main Menu");

                Console.WriteLine("a) Connect Finch Robot");
                Console.WriteLine("b) Talent Show");
                Console.WriteLine("c) Data Recorder");
                Console.WriteLine("d) Alarm System");
                Console.WriteLine("e) User Programming");
                Console.WriteLine("f) Disconnect Finch Robot");
                Console.WriteLine("g) Set Theme");
                Console.WriteLine("q) Quit");
                Console.Write("Enter Choice:");
                menuChoice = Console.ReadLine().ToLower();

                switch (menuChoice)
                {
                    case "a":
                        finchRobotConnected = DisplayConnectFinchRobot(finchRobot);
                        break;
                    case "b":
                        if (finchRobotConnected) TalentShow(finchRobot);
                        else DisplayConnectionIssueInformation();
                        break;
                    case "c":
                        if (finchRobotConnected) DataRecorder(finchRobot);
                        else DisplayConnectionIssueInformation();
                        break;
                    case "d":
                        if (finchRobotConnected) AlarmSystem(finchRobot);
                        else DisplayConnectionIssueInformation();
                        break;
                    case "e":
                        if (finchRobotConnected) UserProgramming(finchRobot);
                        else DisplayConnectionIssueInformation();
                        break;
                    case "f":
                        DisplayDisconnectFinchRobot(finchRobot);
                        break;
                    case "g":
                        ThemeConfig();
                        break;
                    case "q":
                        finchRobot.disConnect();
                        quitApplication = true;
                        break;
                    default:
                        Console.WriteLine();
                        Console.WriteLine("Please provide a proper menu choice.");
                        DisplayContinuePrompt();
                        break;
                }
            } while (!quitApplication);

        }
示例#4
0
        /// <summary>
        /// module: User Programming
        /// </summary>
        static void UserProgramming(Finch finchRobot)
        {
            string menuChoice;
            bool quitApplication = false;
            (int motorSpeed, int ledBrightness, int waitSeconds) commandParameters;
            commandParameters.motorSpeed = 0;
            commandParameters.ledBrightness = 0;
            commandParameters.waitSeconds = 0;
            List<Command> commands = new List<Command>();

            do
            {
                DisplayScreenHeader("User Programming");

                Console.WriteLine("a) Set Command Parameters");
                Console.WriteLine("b) Add Commands");
                Console.WriteLine("c) View Commands");
                Console.WriteLine("d) Execute Commands");
                Console.WriteLine("e) Write Commands to Data File");
                Console.WriteLine("f) Read Commands From Data File");
                Console.WriteLine("q) Return to Main Menu");
                Console.Write("Enter Choice:");
                menuChoice = Console.ReadLine().ToLower();

                switch (menuChoice)
                {
                    case "a":
                        commandParameters = DisplayGetCommandParameters();
                        break;

                    case "b":
                        DisplayGetFinchCommands(commands);
                        break;

                    case "c":
                        DisplayFinchCommands(commands);
                        break;

                    case "d":
                        DisplayExecuteFinchCommands(finchRobot, commands, commandParameters);
                        break;

                    case "e":
                        DisplayWriteUserProgrammingData(commands);
                        break;

                    case "f":
                        commands = DisplayReadUserProgrammingData();
                        break;

                    case "q":
                        quitApplication = true;
                        break;
                    default:
                        Console.WriteLine();
                        Console.WriteLine("Please provide a proper menu choice.");
                        DisplayContinuePrompt();
                        break;
                }
            } while (!quitApplication);

        }
示例#5
0
        //Main Menu

        static void DisplayMenuScreen()
        {
            Console.CursorVisible = true;

            bool   quitApplication = false;
            string menuChoice;

            Finch finchRobot = new Finch();

            do
            {
                DisplayScreenHeader("Main Menu");


                // get user menu choice

                Console.WriteLine("\ta) Connect Finch Robot");
                Console.WriteLine("\tb) Talent Show");

                menuChoice = Console.ReadLine().ToLower();

                // process user menu choice

                switch (menuChoice)
                {
                case "a":
                    DisplayConnectFinchRobot(finchRobot);
                    break;

                case "b":
                    DisplayTalentShowMenuScreen(finchRobot);
                    break;

                case "c":

                    break;

                case "d":

                    break;

                case "e":

                    break;

                case "f":
                    DisplayDisconnectFinchRobot(finchRobot);
                    break;

                case "q":
                    DisplayDisconnectFinchRobot(finchRobot);
                    quitApplication = true;
                    break;

                default:
                    Console.WriteLine();
                    Console.WriteLine("\tPlease enter a letter for the menu choice.");
                    DisplayContinuePrompt();
                    break;
                }
            } while (!quitApplication);
        }
示例#6
0
 private static void DisplayConnectFinchRobot(Finch finchRobot)
 {
     throw new NotImplementedException();
 }