/// <summary> /// Play a tone. /// </summary> /// <param name="volume">Volume.</param> /// <param name="frequency">Frequency of the tone</param> /// <param name="durationMs">Duration in ms.</param> /// <param name="durationMs">Volume .</param> public void PlayTone(UInt16 frequency, UInt16 durationMs, int volume) { if (volume < 0) { volume = -volume; } var command = new MonoBrickFirmware.Tools.ByteArrayCreator(); command.Append(AudioMode.Tone); command.Append((byte)volume); command.Append(frequency); command.Append(durationMs); command.Print(); soundDevice.Write(command.Data); System.Threading.Thread.Sleep(durationMs); }
public void LedPattern(LedColor color, LedEffect effect) { int pattern = (int)color + (int)effect; byte[] cmd = new byte[2]; cmd [0] = (byte)('0' + pattern); dev.Write(cmd); }
public void LedPattern(int pattern) { byte[] cmd = new byte[2]; cmd [0] = (byte)('0' + pattern); dev.Write(cmd); }
/// <summary> /// Reset the output /// </summary> public void Reset() { var command = new ByteArrayCreator(); command.Append(KernelByteCodes.OutputReset); command.Append(BitField); pwmDevice.Write(command.Data); }