public void Configure(IIoTRelay relay, IIoTButton button) { this.button = button; AddComponent(relay, button); button.ButtonDown += Button_ButtonDown; }
public override void Update() { IIoTRelay relayComponent = GetComponent <IIoTRelay> (); relayComponent.Toggle(0); Thread.Sleep(DelayTime); relayComponent.Toggle(1); if (count == 10) { Stop(); Finished?.Invoke(this, EventArgs.Empty); } else { count++; Step?.Invoke(this, count); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); var btnCount = FindViewById <Button> (Resource.Id.btnCount); var btnLight = FindViewById <Button> (Resource.Id.btnLight); var btnNext = FindViewById <Button> (Resource.Id.btnNext); iotButton = new IoTButton(Connectors.GPIO12); iotRelay = new IoTRelay(Connectors.GPIO17, Connectors.GPIO27); iotButton.Clicked += delegate { //Real-life click! btnCount.Text = $"{count++} clicks!"; }; btnCount.Click += delegate { //Virtual click! Toast.MakeText(this, "Push the real button", ToastLength.Long); }; btnLight.Click += delegate { //Toggles the relay on/off iotRelay.Toggle(0); }; //btnNext.Click += delegate { // StartActivity (typeof (MainHubActivity)); //}; iotRelay.Toggle(0); iotRelay.Toggle(0); iotRelay.Toggle(0); iotRelay.Toggle(0); iotRelay.Toggle(1); iotRelay.Toggle(1); iotRelay.Toggle(1); iotRelay.Toggle(1); }
public void Configure(IIoTRelay relay) { AddComponent(relay); SetDelayTime(250); }
public IoTBlind(IIoTRelay contentRelay, int relayPortUp, int relayPortDown) { Relay = contentRelay; AddComponent(Relay); RelayPortUp = relayPortUp; RelayPortDown = relayPortDown; }
public static void Bind(this Button sender, IIoTRelay relay, int portId) { sender.Click += delegate { relay.Toggle(portId); }; }
public void Configure(IIoTSensor presence, IIoTRelay relay) { AddComponent(presence, relay); }