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(); }
// Callback function for motion detected callback static void MotionDetectedCB(BrickletMotionDetector sender) { Console.WriteLine("Motion Detected"); }
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)"); }
// Callback function for detection cycle ended callback static void DetectionCycleEndedCB(BrickletMotionDetector sender) { Console.WriteLine("Detection Cycle Ended (next detection possible in ~3 seconds)"); }
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"); }