private static string UID = "XYZ"; // Change XYZ to the UID of your Sound Intensity Bricklet #endregion Fields #region Methods static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletSoundIntensity si = new BrickletSoundIntensity(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get current intensity int intensity = si.GetIntensity(); Console.WriteLine("Intensity: " + intensity); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Sound Intensity Bricklet static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletSoundIntensity si = new BrickletSoundIntensity(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get current intensity int intensity = si.GetIntensity(); Console.WriteLine("Intensity: " + intensity); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletSoundIntensity si = new BrickletSoundIntensity(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Register intensity callback to function IntensityCB si.IntensityCallback += IntensityCB; // Set period for intensity callback to 0.05s (50ms) // Note: The intensity callback is only called every 0.05 seconds // if the intensity has changed since the last call! si.SetIntensityCallbackPeriod(50); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletSoundIntensity si = new BrickletSoundIntensity(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Register intensity callback to function IntensityCB si.Intensity += IntensityCB; // Set period for intensity callback to 0.05s (50ms) // Note: The intensity callback is only called every 0.05 seconds // if the intensity has changed since the last call! si.SetIntensityCallbackPeriod(50); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletSoundIntensity si = new BrickletSoundIntensity(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get threshold callbacks with a debounce time of 1 second (1000ms) si.SetDebouncePeriod(1000); // Register intensity reached callback to function IntensityReachedCB si.IntensityReachedCallback += IntensityReachedCB; // Configure threshold for intensity "greater than 2000" si.SetIntensityCallbackThreshold('>', 2000, 0); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletSoundIntensity si = new BrickletSoundIntensity(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Get threshold callbacks with a debounce time of 1 second (1000ms) si.SetDebouncePeriod(1000); // Register intensity reached callback to function IntensityReachedCB si.IntensityReached += IntensityReachedCB; // Configure threshold for intensity "greater than 2000" si.SetIntensityCallbackThreshold('>', 2000, 0); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Sound Intensity Bricklet // Callback function for intensity callback static void IntensityCB(BrickletSoundIntensity sender, int intensity) { Console.WriteLine("Intensity: " + intensity); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Sound Intensity Bricklet #endregion Fields #region Methods // Callback function for intensity callback static void IntensityCB(BrickletSoundIntensity sender, int intensity) { Console.WriteLine("Intensity: " + intensity); }