public PongSpeaker(IPConnection ipcon) { if (Config.UID_PIEZO_SPEAKER_BRICKLET == null) { System.Console.WriteLine("Not Configured: Piezo Speaker"); return; } speaker = new BrickletPiezoSpeaker(Config.UID_PIEZO_SPEAKER_BRICKLET, ipcon); try { string uid; string connectedUid; char position; byte[] hardwareVersion; byte[] firmwareVersion; int deviceIdentifier; speaker.GetIdentity(out uid, out connectedUid, out position, out hardwareVersion, out firmwareVersion, out deviceIdentifier); System.Console.WriteLine("Found: Piezo Speaker ({0})", Config.UID_PIEZO_SPEAKER_BRICKLET); } catch (TinkerforgeException) { System.Console.WriteLine("Not Found: Piezo Speaker ({0})", Config.UID_PIEZO_SPEAKER_BRICKLET); return; } okay = true; }
private static string UID = "ABC"; // Change to your UID static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletPiezoSpeaker ps = new BrickletPiezoSpeaker(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Morse SOS with a frequency of 2kHz ps.MorseCode("... --- ...", 2000); System.Console.WriteLine("Press enter to exit"); System.Console.ReadLine(); }
private static string UID = "ABC"; // Change to your UID static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletPiezoSpeaker ps = new BrickletPiezoSpeaker(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Make 2 second beep with a frequency of 1kHz ps.Beep(2000, 1000); System.Console.WriteLine("Press enter to exit"); System.Console.ReadLine(); }
private static string UID = "XYZ"; // Change XYZ to the UID of your Piezo Speaker Bricklet #endregion Fields #region Methods static void Main() { IPConnection ipcon = new IPConnection(); // Create IP connection BrickletPiezoSpeaker ps = new BrickletPiezoSpeaker(UID, ipcon); // Create device object ipcon.Connect(HOST, PORT); // Connect to brickd // Don't use device before ipcon is connected // Morse SOS with a frequency of 2kHz ps.MorseCode("... --- ...", 2000); Console.WriteLine("Press enter to exit"); Console.ReadLine(); ipcon.Disconnect(); }