public static int Main(String[] args) { using (var track = new TrackConnection()) { GameLoop(track); } return(0); }
private static void GameLoop(TrackConnection track) { var onOff = false; while (true) { if (!string.IsNullOrEmpty(track.GetLatestResponse())) { Console.WriteLine(track.GetLatestResponse()); } var speed = onOff ? 100 : 0; track.SendSpeed(speed); onOff = !onOff; Thread.Sleep(1000); } }