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); }
public async Task FanOn() { await Task.Run(() => { RelayBoard.Set(RelayNumbers.K05, Relaystate.ON); }); }
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); }
public async Task LampOff() { await Task.Run(() => { RelayBoard.Set(RelayNumbers.K06, Relaystate.OFF); _timer.Start(); }); }
public async Task LampOn() { await FanOn(); await Task.Run(() => { RelayBoard.Set(RelayNumbers.K06, Relaystate.ON); _lampWasOn = true; }); }
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); }); }
public async Task FanOff(bool force = false) { await Task.Run(() => { if (_lampWasOn && !force) { _timer.Start(); } else { RelayBoard.Set(RelayNumbers.K05, Relaystate.OFF); } }); }
public async Task Unload() { await Task.Run(() => RelayBoard.Set(RelayNumbers.K07 | RelayNumbers.K08, Relaystate.ON)); }
void Relays_CheckedChanged(object sender, EventArgs e) { var box = sender as CheckBox; RelayBoard.Set((RelayNumbers)box.Tag, box.Checked ? Relaystate.ON : Relaystate.OFF); }