///<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"); }
/// <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"); }
static void ExploreSounds(Finch finchRobot) { finchRobot.noteOn(523); finchRobot.wait(100); finchRobot.noteOn(587); finchRobot.wait(100); finchRobot.noteOn(659); finchRobot.wait(100); finchRobot.noteOn(698); finchRobot.wait(100); finchRobot.noteOn(784); finchRobot.wait(100); finchRobot.noteOn(880); finchRobot.wait(100); finchRobot.noteOn(988); finchRobot.wait(100); finchRobot.noteOn(1047); finchRobot.wait(100); finchRobot.noteOff(); for (int soundValue = 100; soundValue < 15000; soundValue = soundValue + 80) { finchRobot.noteOn(soundValue); finchRobot.wait(1); finchRobot.noteOff(); } }
/// <summary> /// Plays the last few notes of Imperial March. WARNING: LONG CODE BLOCK! /// </summary> /// <param name="myFinch"></param> public static void PlayGameOverMarch(Finch myFinch) { // Just the last five notes: myFinch.noteOn(349); myFinch.wait(250); myFinch.noteOff(); myFinch.wait(10); myFinch.noteOn(415); myFinch.wait(500); myFinch.noteOff(); myFinch.wait(10); myFinch.noteOn(349); myFinch.wait(375); myFinch.noteOff(); myFinch.wait(10); myFinch.noteOn(261); myFinch.wait(125); myFinch.noteOff(); myFinch.wait(10); myFinch.noteOn(475); myFinch.wait(1000); myFinch.noteOff(); myFinch.wait(100); }
static void LineSix(Finch finchRobot) { // G finchRobot.noteOn(784); finchRobot.wait(120); finchRobot.noteOff(); finchRobot.wait(50); // F# finchRobot.noteOn(740); finchRobot.wait(120); finchRobot.noteOff(); finchRobot.wait(50); // F finchRobot.noteOn(698); finchRobot.wait(120); finchRobot.noteOff(); finchRobot.wait(50); // D# finchRobot.noteOn(622); finchRobot.wait(120); finchRobot.noteOff(); finchRobot.wait(150); // E finchRobot.noteOn(659); finchRobot.wait(120); finchRobot.noteOff(); finchRobot.wait(150); }
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); } }
static bool SentryVersusThresholdValue(double lowerTempThreshold, Finch finch, double upperLightThreshold) { if (finch.getTemperature() <= lowerTempThreshold) { for (int i = 0; i < 5; i++) { finch.noteOn(600); finch.wait(50); finch.noteOff(); } Console.WriteLine("Temperature Reached Threshold. Press Any Key To Continue."); Console.ReadKey(); return(true); } else if ((finch.getLeftLightSensor() + finch.getRightLightSensor()) / 2 >= upperLightThreshold) { for (int i = 0; i < 5; i++) { finch.noteOn(600); finch.wait(50); finch.noteOff(); } Console.WriteLine("Light Reached Threshold. Press Any Key To Continue."); Console.ReadKey(); return(true); } else { return(false); } }
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(); }
// // Talent Show Song // static void TalentShowDisplaySong(Finch finchRobot) { Console.CursorVisible = false; DisplayScreenHeader("Song Time"); Console.WriteLine("\tThe Finch robot will now show off its enormous Pipes!"); DisplayContinuePrompt(); finchRobot.noteOn(1975); finchRobot.wait(500); finchRobot.noteOn(1760); finchRobot.wait(500); finchRobot.noteOn(1567); finchRobot.wait(1000); finchRobot.noteOn(1975); finchRobot.wait(500); finchRobot.noteOn(1760); finchRobot.wait(500); finchRobot.noteOn(1567); finchRobot.wait(1000); finchRobot.noteOff(); finchRobot.noteOn(1567); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1567); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1567); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1567); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1760); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1760); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1760); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1760); finchRobot.wait(250); finchRobot.noteOff(); finchRobot.noteOn(1975); finchRobot.wait(500); finchRobot.noteOn(1760); finchRobot.wait(500); finchRobot.noteOn(1567); finchRobot.wait(1000); finchRobot.noteOff(); DisplayMenuPrompt("Talent Show Menu"); }
// //Robot begins playing a series of notes // private static void RoboticSinging(Finch myFinch) { myFinch.setLED(255, 0, 0); myFinch.noteOn(233); myFinch.wait(2000); myFinch.noteOff(); myFinch.wait(10); myFinch.noteOn(233); myFinch.wait(2000); myFinch.noteOff(); }
/// <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 now show off its glowing talent!"); DisplayContinuePrompt(); for (int soundLevel = 0; soundLevel < 10000; soundLevel = soundLevel + 50) { finchRobot.noteOn(soundLevel); } finchRobot.noteOff(); for (int i = 0; i < 100; i++) { finchRobot.setLED(255, 0, 0); finchRobot.wait(10); finchRobot.setLED(0, 0, 0); finchRobot.wait(10); } for (int soundLevel = 10000; soundLevel > 0; soundLevel = soundLevel - 50) { finchRobot.noteOn(soundLevel); } finchRobot.noteOff(); finchRobot.setMotors(255, -255); finchRobot.wait(1000); finchRobot.setMotors(0, 0); finchRobot.setMotors(-255, 255); finchRobot.wait(1000); finchRobot.setMotors(0, 0); finchRobot.setMotors(255, -255); finchRobot.wait(1000); finchRobot.setMotors(0, 0); finchRobot.setMotors(-255, 255); finchRobot.wait(1000); finchRobot.setMotors(0, 0); finchRobot.setMotors(255, -255); finchRobot.wait(1000); finchRobot.setMotors(0, 0); finchRobot.setMotors(-255, 255); finchRobot.wait(1000); finchRobot.setMotors(0, 0); DisplayMenuPrompt("Talent Show Menu"); }
static void LineThree(Finch finchRobot) { // G finchRobot.noteOn(784); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(50); // E finchRobot.noteOn(659); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(80); // G finchRobot.noteOn(784); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(50); // A finchRobot.noteOn(880); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(80); // F finchRobot.noteOn(698); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(50); // G finchRobot.noteOn(784); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(50); // E finchRobot.noteOn(659); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(200); // C finchRobot.noteOn(523); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(30); // B finchRobot.noteOn(988); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(30); // D finchRobot.noteOn(587); finchRobot.wait(150); finchRobot.noteOff(); finchRobot.wait(250); }
/// <summary> /// displays flashing lights /// </summary> static void DisplayLightShow(Finch ros, int r, int g, int b) { for (int i = 0; i < 5; i++) { ros.noteOn(794); ros.wait(50); ros.noteOff(); ros.setLED(r, 0, 0); ros.wait(200); ros.setLED(0, 0, 0); ros.wait(200); } for (int i = 0; i < 5; i++) { ros.noteOn(880); ros.wait(50); ros.noteOff(); ros.setLED(0, g, 0); ros.wait(250); ros.setLED(0, 0, 0); ros.wait(250); } for (int i = 0; i < 5; i++) { ros.noteOn(988); ros.wait(50); ros.noteOff(); ros.setLED(0, 0, b); ros.wait(300); ros.setLED(0, 0, 0); ros.wait(300); } for (int i = 0; i < 5; i++) { ros.noteOn(794); ros.wait(50); ros.noteOn(880); ros.wait(50); ros.noteOn(988); ros.wait(50); ros.noteOff(); ros.setLED(r, g, b); ros.wait(500); ros.setLED(0, 0, 0); ros.wait(500); } }
/// <summary> /// displays alarm system /// </summary> static void DisplayAlarmSystem(Finch ros) { DisplayScreenHeader("Alarm System"); string alarmType = DisplayGetAlarmType(); int maxSeconds = DisplayGetMaxSeconds(); double threshold = DisplayGetThreshold(ros, alarmType); Console.Clear(); Console.WriteLine(); Console.WriteLine($"Next, the Finch Robot will monitor your {alarmType} levels."); DisplayContinuePrompt(); bool thresholdExceeded; if (alarmType == "light") { thresholdExceeded = MonitorCurrentLightLevels(ros, threshold, maxSeconds); if (thresholdExceeded) { ros.noteOn(987); ros.wait(100); ros.noteOn(1200); ros.wait(200); ros.noteOff(); Console.WriteLine("Maximum Light Level Exceeded"); } } else if (alarmType == "temperature") { thresholdExceeded = MonitorCurrentTemperatureLevels(ros, threshold, maxSeconds); if (thresholdExceeded) { ros.noteOn(987); ros.wait(100); ros.noteOn(1200); ros.wait(200); ros.noteOff(); Console.WriteLine("Maximum Temperature Exceeded"); } } else { ros.noteOn(987); ros.wait(100); ros.noteOn(1200); ros.wait(200); ros.noteOff(); Console.WriteLine("Maximum Time Exceeded"); } DisplayContinuePrompt(); }
static void DisplayAlarmSystemScreen(Finch finchRobot) { string alarmType; int maxLimit; double maxThreshold; double minThreshold; bool thresholdExceeded; DisplayScreenHeader("Alarm System"); alarmType = DisplayGetAlarmType(); maxLimit = DisplayGetMaxLimit(); DisplayGetThreshhold(finchRobot, alarmType, out minThreshold, out maxThreshold); Console.WriteLine(); Console.WriteLine("The Alarm is now set"); DisplayContinuePrompt(); finchRobot.setLED(255, 0, 255); thresholdExceeded = MonitorLevels(finchRobot, minThreshold, maxThreshold, maxLimit, alarmType); if (thresholdExceeded) { if (alarmType == "light") { Console.WriteLine("Maximum or minimum light level exceeded"); } else { Console.WriteLine("Maximum or minimum temperature level exceeded"); } finchRobot.setLED(255, 0, 0); for (int i = 0; i < 5; i++) { finchRobot.noteOn(10000); finchRobot.wait(1000); finchRobot.noteOff(); finchRobot.wait(300); } } else { Console.WriteLine(); Console.WriteLine("Maximum time exceeded"); } DisplayContinuePrompt(); finchRobot.noteOff(); finchRobot.setLED(0, 0, 0); }
/// <summary> /// plays music /// </summary> static void DisplaySong(Finch ros) { Console.WriteLine(); Console.WriteLine("Now Playing: The Greatest Adventure - The Hobbit(1973)"); ros.noteOn(523); ros.wait(500); ros.noteOn(698); ros.wait(1000); ros.noteOn(698); ros.wait(500); ros.noteOn(659); ros.wait(500); ros.noteOn(698); ros.wait(500); ros.noteOn(880); ros.wait(1000); ros.noteOn(698); ros.wait(500); ros.noteOn(784); ros.wait(1000); ros.noteOn(988); ros.wait(750); ros.noteOn(880); ros.wait(250); ros.noteOn(784); ros.wait(1000); ros.noteOff(); }
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(); }
static bool DisplayConnectFinchRobot(Finch finchRobot) { bool robotConnected; DisplayScreenHeader("Connect Finch Robot"); Console.WriteLine("About 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) { finchRobot.setLED(0, 255, 0); finchRobot.noteOn(15000); finchRobot.wait(1000); finchRobot.noteOff(); Console.WriteLine("The Finch robot is now connected."); } else { Console.WriteLine("Unable to connect to the Finch robot."); } DisplayContinuePrompt(); return(robotConnected); }
/// <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(); }
/// <summary> /// ***************************************************************** /// * Talent Show > Play A Song * /// ***************************************************************** /// </summary> /// <param name="finchRobot">finch robot object</param> static void DisplayPlayASong(Finch finchRobot) { Console.CursorVisible = false; DisplayScreenHeader("Play A Song"); Console.WriteLine("\tThe Finch robot will now play a song!"); DisplayContinuePrompt(); // song = Beethoven - Fur Elise finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(311); finchRobot.wait(500); finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(493); finchRobot.wait(500); finchRobot.noteOn(311); finchRobot.wait(500); finchRobot.noteOn(261); finchRobot.wait(500); finchRobot.noteOn(440); finchRobot.wait(500); finchRobot.noteOn(261); finchRobot.wait(500); finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(440); finchRobot.wait(500); finchRobot.noteOn(493); finchRobot.wait(500); finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(261); finchRobot.wait(500); finchRobot.noteOn(493); finchRobot.wait(500); finchRobot.noteOn(440); finchRobot.wait(500); finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(311); finchRobot.wait(500); finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(311); finchRobot.wait(500); finchRobot.noteOn(329); finchRobot.wait(500); finchRobot.noteOn(493); finchRobot.wait(500); finchRobot.noteOn(311); finchRobot.wait(500); finchRobot.noteOn(261); finchRobot.wait(500); finchRobot.noteOff(); DisplayMenuPrompt("Talent Show Menu"); }
/// <summary> /// ***************************************************************** /// * Talent Show > Light and Sound * /// ***************************************************************** /// </summary> /// <param name="finchRobot">finch robot object</param> static void TalentShowDisplayLightAndSound(Finch finchRobot) { Console.CursorVisible = false; DisplayScreenHeader("Light and Sound"); Console.WriteLine("\tThe Finch robot will now show off its glowing talent!"); DisplayContinuePrompt(); for (int lightSoundLevel = 0; lightSoundLevel < 255; lightSoundLevel++) { finchRobot.setLED(lightSoundLevel, lightSoundLevel, lightSoundLevel); finchRobot.noteOn(lightSoundLevel * 100); } finchRobot.setLED(0, 255, 0); finchRobot.noteOn(262); finchRobot.wait(1000); finchRobot.setLED(255, 0, 0); finchRobot.noteOn(294); finchRobot.wait(1000); finchRobot.setLED(0, 0, 255); finchRobot.noteOn(392); finchRobot.wait(500); finchRobot.setLED(255, 0, 0); finchRobot.noteOn(494); finchRobot.wait(800); finchRobot.setLED(83, 162, 48); finchRobot.noteOn(294); finchRobot.wait(2000); finchRobot.setLED(0, 0, 0); finchRobot.noteOff(); DisplayMenuPrompt("Talent Show Menu"); }
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> /// ***************************************************************** /// * 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); }
//*********************************************************************** // Talent show > Mix it up //*********************************************************************** static void TalentShowDisplayMixItUp(Finch finchRobot) { Console.CursorVisible = false; DisplayScreenHeader("Mix it up"); Console.WriteLine("\tThe Finch robot will not show off all of its moves!"); DisplayContinuePrompt(); finchRobot.noteOn(698); finchRobot.wait(10); finchRobot.setLED(0, 255, 0); finchRobot.setMotors(0, 50); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(255, 0, 0); finchRobot.setMotors(50, 0); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(0, 0, 255); finchRobot.setMotors(0, 50); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(0, 255, 0); finchRobot.setMotors(0, 50); finchRobot.wait(10); finchRobot.noteOn(659); finchRobot.setLED(255, 0, 0); finchRobot.setMotors(50, 0); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(0, 0, 255); finchRobot.setMotors(50, 0); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(255, 0, 0); finchRobot.setMotors(0, 50); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(0, 255, 0); finchRobot.setMotors(0, 50); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(0, 0, 255); finchRobot.setMotors(50, 0); finchRobot.wait(10); finchRobot.noteOn(659); finchRobot.setLED(0, 255, 0); finchRobot.setMotors(0, 50); finchRobot.wait(10); finchRobot.noteOn(698); finchRobot.setLED(0, 0, 255); finchRobot.setMotors(50, 0); finchRobot.wait(10); finchRobot.noteOff(); DisplayMenuPrompt("Talent Show Menu"); }
// // 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); }
// Connect to the Finch 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 DisplayMenuPrompt("Main"); // // reset finch robot // finchRobot.setLED(0, 0, 0); finchRobot.noteOff(); return(robotConnected); }
/// <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(); }
// //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); }
static void LineEleven(Finch finchRobot) { // D# finchRobot.noteOn(622); finchRobot.wait(200); finchRobot.noteOff(); finchRobot.wait(200); // D finchRobot.noteOn(587); finchRobot.wait(200); finchRobot.noteOff(); finchRobot.wait(200); // C finchRobot.noteOn(523); finchRobot.wait(200); finchRobot.noteOff(); }
/// <summary> /// display initialize screen /// </summary> static void DisplayInitializeFinch() { DisplayScreen("Initialize Finch"); finchActive = tim.connect(); Console.WriteLine($"Finch connected: {finchActive}"); if (finchActive) { tim.noteOn(500); tim.setLED(255, 255, 255); tim.wait(500); tim.setLED(0, 0, 0); tim.noteOff(); } DisplayAnyKey(); }