Exemple #1
0
 private void ForwardButton_Click(object sender, EventArgs e)
 {
     RelayBoard.Set(RelayNumbers.All, Relaystate.OFF);
     RelayBoard.Set(RelayNumbers.K03, Relaystate.ON);
     Thread.Sleep(1000);
     RelayBoard.Set(RelayNumbers.K03, Relaystate.OFF);
 }
Exemple #2
0
 public async Task FanOn()
 {
     await Task.Run(() =>
     {
         RelayBoard.Set(RelayNumbers.K05, Relaystate.ON);
     });
 }
Exemple #3
0
 private void ReverseButton_Click(object sender, EventArgs e)
 {
     RelayBoard.Set(RelayNumbers.All, Relaystate.OFF);
     RelayBoard.Set(RelayNumbers.K01 | RelayNumbers.K02, Relaystate.ON);
     RelayBoard.Set(RelayNumbers.K04, Relaystate.ON);
     Thread.Sleep(1000);
     RelayBoard.Set(RelayNumbers.K04, Relaystate.OFF);
 }
Exemple #4
0
 public async Task LampOff()
 {
     await Task.Run(() =>
     {
         RelayBoard.Set(RelayNumbers.K06, Relaystate.OFF);
         _timer.Start();
     });
 }
Exemple #5
0
        public async Task LampOn()
        {
            await FanOn();

            await Task.Run(() =>
            {
                RelayBoard.Set(RelayNumbers.K06, Relaystate.ON);
                _lampWasOn = true;
            });
        }
Exemple #6
0
 public async Task Forward()
 {
     await Task.Run(() =>
     {
         RelayBoard.Set(RelayNumbers.K01 | RelayNumbers.K02 | RelayNumbers.K04, Relaystate.OFF); // clear all
         Thread.Sleep(50);
         RelayBoard.Set(RelayNumbers.K03, Relaystate.ON);                                        // Set direction
         Thread.Sleep(500);
         RelayBoard.Set(RelayNumbers.K03, Relaystate.OFF);
     });
 }
Exemple #7
0
 public async Task FanOff(bool force = false)
 {
     await Task.Run(() =>
     {
         if (_lampWasOn && !force)
         {
             _timer.Start();
         }
         else
         {
             RelayBoard.Set(RelayNumbers.K05, Relaystate.OFF);
         }
     });
 }
Exemple #8
0
 public async Task Unload()
 {
     await Task.Run(() => RelayBoard.Set(RelayNumbers.K07 | RelayNumbers.K08, Relaystate.ON));
 }
Exemple #9
0
        void Relays_CheckedChanged(object sender, EventArgs e)
        {
            var box = sender as CheckBox;

            RelayBoard.Set((RelayNumbers)box.Tag, box.Checked ? Relaystate.ON : Relaystate.OFF);
        }