I have a simple console app written in C#. I want to be able to detect arrow key presses, so I can allow the user to steer. How do I detect keydown/keyup events with a con
var isUp = Console.ReadKey().Key == ConsoleKey.UpArrow;
or another example, just for your case:
while (true)
{
var ch = Console.ReadKey(false).Key;
switch(ch)
{
case ConsoleKey.Escape:
ShutdownRobot();
return;
case ConsoleKey.UpArrow:
MoveRobotUp();
break;
case ConsoleKey.DownArrow:
MoveRobotDown();
break;
}
}