/// <summary> /// Initialisiert den Schalter. /// </summary> /// <param name="swi">der abzubildende Schalter</param> public Switch(Switches swi, DigitalIn aDigitalIn) { this.swi = swi; this.digitalIn = aDigitalIn; this.digitalIn.DigitalInChanged += new EventHandler(digitalInChanged); this.oldState = false; }
/// <summary> /// Initialisiert die Roboter-Konsole mit den dazugehörigen LED's und Schalter. /// </summary> public RobotConsole(RunMode runMode) { if (!Constants.IsWinCE) runMode = RunMode.Virtual; if (runMode == RunMode.Virtual) { digitalIn = new DigitalInSim(); digitalOut = new DigitalOutSim(); } else { // digitalIn = new DigitalInHW(Constants.IOConsoleSWITCH); digitalIn = new DigitalInHW(Constants.IOConsoleSWITCH); digitalOut = new DigitalOutHW(Constants.IOConsoleLED); } this.leds = new Led[4]; for (int i = 0; i < this.leds.Length; i++) { leds[i] = new Led(digitalOut,(Leds)i); } this.blinkingLeds = new BlinkingLed[4]; for (int i = 0; i < this.blinkingLeds.Length; i++) { blinkingLeds[i] = new BlinkingLed(digitalOut, (BlinkingLeds)i); } this.switches = new Switch[4]; for (int i = 0; i < this.switches.Length; i++) { switches[i] = new Switch(digitalIn, (Switches)i); } }
/// <summary> /// Initialisiert die Roboter-Konsole mit den dazugehörigen LED's und Schalter. /// </summary> public RobotConsole(RunMode aRunMode) { if (aRunMode == RunMode.Virtual) { digitalIn = new DigitalInSim(); digitalOut = new DigitalOutSim(); } else { digitalIn = new DigitalInHW(Constants.IOConsoleSWITCH); digitalOut = new DigitalOutHW(Constants.IOConsoleLED); } this.leds = new Led[4]; for (int i = 0; i < this.leds.Length; i++) { leds[i] = new Led((Leds)i, digitalOut); if (i % 2 == 0) { leds[i].LedEnabled = false; } } this.switches = new Switch[4]; for (int i = 0; i < this.switches.Length; i++) { switches[i] = new Switch((Switches)i, digitalIn); switches[i].SwitchStateChanged += new EventHandler<SwitchEventArgs>(RobotConsole_SwitchStateChanged); } }
/// <summary> /// Initialisiert den Schalter. /// </summary> /// <param name="digitalIn">das zu verwendende DigitalIn-Objekt</param> /// <param name="swi">der abzubildende Schalter</param> public Switch(DigitalIn digitalIn, Switches swi) { this.digitalIn = digitalIn; this.swi = swi; this.oldState = false; this.digitalIn.DigitalInChanged += new EventHandler(DigitalInChanged); }
/// <summary> /// Initialisiert den Schalter. /// </summary> /// <param name="swi">der abzubildende Schalter</param> public Switch(DigitalIn digitalIn, Switches swi) { this.digitalIn = digitalIn; this.swi = swi; this.oldState = false; this.digitalIn.DigitalInChanged += new EventHandler(digitalIn_DigitalInChanged); }
/// <summary> /// Initialisiert die Roboter-Konsole mit den dazugehörigen LED's und Schalter. /// </summary> /// /// <param name="runMode">Der gewünschte RunMode (Simulation oder Roboter)</param> public RobotConsole() { digitalIn = new DigitalIn(Constants.IOConsoleSWITCH); digitalOut = new DigitalOut(Constants.IOConsoleLED); this.leds = new Led[4]; for (int i = 0; i < this.leds.Length; i++) { leds[i] = new Led(digitalOut, (Leds)i); } this.switches = new Switch[4]; for (int i = 0; i < this.switches.Length; i++) { switches[i] = new Switch(digitalIn, (Switches)i); } }