static void Display1602() { Display1602 display = new Display1602(16, 12, 26, 25, 24, 23); display.Clear(); display.SetCursor(1, 1); display.Write("Line 1"); display.SetCursor(3, 2); display.Write("Line 2"); }
static void UltrasonicSensorDisplay1602() { UltraSonicSensor sensor = new UltraSonicSensor(21, 20, 2000); Display1602 display = new Display1602(16, 12, 26, 25, 24, 23); display.Clear(); while (true) { if (sensor.ReadDistance() == false) { Console.WriteLine("Error"); } else { Console.WriteLine(String.Format("Milliseconds: {0:0.0000}", sensor.Milliseconds)); Console.WriteLine(String.Format("Distance: {0:0.0} cm", sensor.Distance)); display.SetCursor(1, 1); display.Write(String.Format("Ms: {0:0.0000}", sensor.Milliseconds)); display.SetCursor(1, 2); display.Write(String.Format("Dt: {0:0.0} cm", sensor.Distance)); Console.ReadLine(); } } }