コード例 #1
0
    static void Main()
    {
        IPConnection ipcon = new IPConnection(); // Create IP connection
        BrickletMotionDetector md = new BrickletMotionDetector(UID, ipcon); // Create device object

        ipcon.Connect(HOST, PORT); // Connect to brickd
        // Don't use device before ipcon is connected

        // Register motion detected callback to function MotionDetectedCB
        md.MotionDetected += MotionDetectedCB;

        // Register detection cycle ended callback to function DetectionCycleEndedCB
        md.DetectionCycleEnded += DetectionCycleEndedCB;

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
コード例 #2
0
    static void Main()
    {
        IPConnection           ipcon = new IPConnection();                     // Create IP connection
        BrickletMotionDetector md    = new BrickletMotionDetector(UID, ipcon); // Create device object

        ipcon.Connect(HOST, PORT);                                             // Connect to brickd
        // Don't use device before ipcon is connected

        // Register motion detected callback to function MotionDetectedCB
        md.MotionDetected += MotionDetectedCB;

        // Register detection cycle ended callback to function DetectionCycleEndedCB
        md.DetectionCycleEnded += DetectionCycleEndedCB;

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }
コード例 #3
0
 // Callback function for motion detected callback
 static void MotionDetectedCB(BrickletMotionDetector sender)
 {
     Console.WriteLine("Motion Detected");
 }
コード例 #4
0
    private static string UID = "XYZ"; // Change XYZ to the UID of your Motion Detector Bricklet

    #endregion Fields

    #region Methods

    // Callback function for detection cycle ended callback
    static void DetectionCycleEndedCB(BrickletMotionDetector sender)
    {
        Console.WriteLine("Detection Cycle Ended (next detection possible in ~3 seconds)");
    }
コード例 #5
0
 // Callback function for detection cycle ended callback
 static void DetectionCycleEndedCB(BrickletMotionDetector sender)
 {
     Console.WriteLine("Detection Cycle Ended (next detection possible in ~3 seconds)");
 }
コード例 #6
0
    private static string UID  = "XYZ";    // Change XYZ to the UID of your Motion Detector Bricklet

    // Callback function for motion detected callback
    static void MotionDetectedCB(BrickletMotionDetector sender)
    {
        Console.WriteLine("Motion Detected");
    }