public MainPage() { InitializeComponent(); Unloaded += MainPage_Unloaded; //Window.Current.CoreWindow.PointerCursor = null; connection = new RemoteConnection(); connection.OnLedEvent(LedEvent); led = new MulticolorLed(redPinNumber: 18, greenPinNumber: 23, bluePinNumber: 24); humitureSensor = new Dht11HumitureSensor(pinNumber: 4); relay = new Relay(pinNumber: 16); motionDetector = new Sr501PirMotionDetector(pinNumber: 12); motionDetector.RaiseEventsOnUIThread = true; motionDetector.MotionDetected += MotionDetector_MotionDetected; motionDetector.MotionStopped += MotionDetector_MotionStopped; flameSensor = new FlameSensor(pinNumber: 27); flameSensor.RaiseEventsOnUIThread = true; flameSensor.FlameDetected += FlameSensor_FlameDetected; flameSensor.FlameExtinguished += FlameSensor_FlameExtinguished; timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) }; timer.Tick += Timer_Tick; }
/// <summary> /// Create Instance of DHT11 sensor.<see cref="IoTHelpers.Gpio.Modules.Dht11HumitureSensor"/> /// </summary> /// <param name="pinNumber">Pin position on GPIO Border. GPIO is PIN board of controller.</param> public DHT11(int pinNumber = DHT11_PIN) { this.m_sensor = new IoTHelpers.Gpio.Modules.Dht11HumitureSensor(pinNumber, IoTHelpers.ReadingMode.Manual); if (this.m_sensor == null) { Message = "IoTHelpers.Gpio.Modules.Dht11HumitureSensor intialization (Open Pin) FAILED! \n \n Program Exit!"; return; } this.pinNumber = pinNumber; }