private void TriggerSwitch(string name, int selectionMask)
    {
        if (brickletIndustrialQuadRelayV2 == null)
        {
            Log("No Industrial Quad Relay V2 Bricklet found");
            return;
        }

        try
        {
            if (selectionMask == A_ON)
            {
                // Channel 0 and 2 are closed for 500 ms
                brickletIndustrialQuadRelayV2.SetMonoflop(0, true, 500);
                brickletIndustrialQuadRelayV2.SetMonoflop(2, true, 500);
            }
            else if (selectionMask == A_OFF)
            {
                // Channel 0 and 3 are closed for 500 ms
                brickletIndustrialQuadRelayV2.SetMonoflop(0, true, 500);
                brickletIndustrialQuadRelayV2.SetMonoflop(3, true, 500);
            }
            else if (selectionMask == B_ON)
            {
                // Channel 1 and 2 are closed for 500 ms
                brickletIndustrialQuadRelayV2.SetMonoflop(1, true, 500);
                brickletIndustrialQuadRelayV2.SetMonoflop(2, true, 500);
            }
            else if (selectionMask == B_OFF)
            {
                // Channel 1 and 3 are closed for 500 ms
                brickletIndustrialQuadRelayV2.SetMonoflop(1, true, 500);
                brickletIndustrialQuadRelayV2.SetMonoflop(3, true, 500);
            }

            Log("Triggered '" + name + "'");
        }
        catch (TinkerforgeException e)
        {
            Log("Trigger '" + name + "' Error: " + e.Message);
        }
    }
示例#2
0
    private static string UID  = "2g2gRs";    // Change to your UID

    static void AOn(BrickletIndustrialQuadRelayV2 iqr)
    {
        // Close channels 0 and 2 for 1.5 seconds
        iqr.SetMonoflop(0, true, 1500);
        iqr.SetMonoflop(2, true, 1500);
    }
示例#3
0
 static void BOff(BrickletIndustrialQuadRelayV2 iqr)
 {
     // Close channels 1 and 3 for 1.5 seconds
     iqr.SetMonoflop(1, true, 1500);
     iqr.SetMonoflop(3, true, 1500);
 }