예제 #1
0
        private void SetupLEDStripRemote(I2CHardwareBridge i2CHardwareBridge, VirtualButtonGroup group)
        {
            var ledStripRemote = new LEDStripRemote(i2CHardwareBridge, 4);

            group.WithButton(new ActuatorId("on"), b => b.WithShortAction(() => ledStripRemote.TurnOn()))
            .WithButton(new ActuatorId("off"), b => b.WithShortAction(() => ledStripRemote.TurnOff()))
            .WithButton(new ActuatorId("white"), b => b.WithShortAction(() => ledStripRemote.TurnWhite()))

            .WithButton(new ActuatorId("red1"), b => b.WithShortAction(() => ledStripRemote.TurnRed1()))
            .WithButton(new ActuatorId("green1"), b => b.WithShortAction(() => ledStripRemote.TurnGreen1()))
            .WithButton(new ActuatorId("blue1"), b => b.WithShortAction(() => ledStripRemote.TurnBlue1()));
        }
예제 #2
0
        private void SetupLEDStripRemote(I2CHardwareBridge i2CHardwareBridge, IArea area)
        {
            const int SenderPin = 4;

            var ledStripRemote = new LEDStripRemote(i2CHardwareBridge, SenderPin);

            area.WithVirtualButton(ExampleRoom.ButtonStripOn, b => b.WithPressedShortlyAction(() => ledStripRemote.TurnOn()))
            .WithVirtualButton(ExampleRoom.ButtonStripOff, b => b.WithPressedShortlyAction(() => ledStripRemote.TurnOff()))
            .WithVirtualButton(ExampleRoom.ButtonStripWhite, b => b.WithPressedShortlyAction(() => ledStripRemote.TurnWhite()))

            .WithVirtualButton(ExampleRoom.ButtonStripRed, b => b.WithPressedShortlyAction(() => ledStripRemote.TurnRed1()))
            .WithVirtualButton(ExampleRoom.ButtonStripGreen, b => b.WithPressedShortlyAction(() => ledStripRemote.TurnGreen1()))
            .WithVirtualButton(ExampleRoom.ButtonStripBlue, b => b.WithPressedShortlyAction(() => ledStripRemote.TurnBlue1()));
        }