public MeadowApp() { hCSR04 = new HCSR04(Device, Device.Pins.D05, Device.Pins.D06); hCSR04.DistanceDetected += HCSR04DistanceDetected; while (true) { // Sends a trigger signal hCSR04.MeasureDistance(); Thread.Sleep(1500); } }
public static void Main() { var _HCSR04 = new HCSR04(Pins.GPIO_PIN_D12, Pins.GPIO_PIN_D11); _HCSR04.DistanceDetected += OnDistanceDetected; while (true) { // Send a echo _HCSR04.MeasureDistance(); Thread.Sleep(500); } }