/// <summary> /// module: Alarm System /// </summary> static void AlarmSystem(Finch finchRobot) { string alarmType; int maxSeconds; double upperThreshold; double lowerThreshold; bool thresholdExceeded; DisplayScreenHeader("Alarm System"); alarmType = DisplayGetAlarmType(); maxSeconds = DisplayGetMaxSeconds(); DisplayGetThreshhold(finchRobot, alarmType, out lowerThreshold, out upperThreshold); Console.WriteLine(); Console.WriteLine("Once you continue the alarm will be set"); DisplayContinuePrompt(); finchRobot.setLED(0, 255, 0); thresholdExceeded = MonitorLevels(finchRobot, lowerThreshold, upperThreshold, maxSeconds, 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(5000); finchRobot.wait(500); finchRobot.noteOff(); finchRobot.wait(500); } } else { Console.WriteLine(); Console.WriteLine("Maximum time exceeded"); } DisplayContinuePrompt(); finchRobot.noteOff(); finchRobot.setLED(0, 0, 0); }
//Talent Show / Light and Sound 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 < 255; lightSoundLevel++) { object p = finchRobot.setLED(lightSoundLevel, lightSoundLevel, lightSoundLevel); finchRobot.noteOn(lightSoundLevel * 100); } DisplayMenuPrompt("Talent Show Menu"); }
/// <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(); }