/// <summary> /// Reads an analog value from the ADC on the Gertboard. /// </summary> /// <returns> /// The analog value retrieved. /// </returns> /// <param name="channel"> /// The channel to read from. /// </param> /// <exception cref="InvalidOperationException"> /// Not yet initialized. Call <see cref="Initialize()"/> before use. /// </exception> public static Int32 AnalogRead(GertboardAdcChannels channel) { if (!_initialized) { throw new InvalidOperationException("You must call Initialize() before use."); } return(UnsafeNativeMethods.gertboardAnalogRead((Int32)channel)); }
/// <summary> /// Writes an 8-bit data value to ADC on the Gertboard. /// </summary> /// <param name="channel"> /// The channel to write to. /// </param> /// <param name="value"> /// The value to write. /// </param> /// <exception cref="InvalidOperationException"> /// Not yet initialized. Call <see cref="Initialize()"/> before use. /// </exception> public static void AnalogWrite(GertboardAdcChannels channel, Int32 value) { if (!_initialized) { throw new InvalidOperationException("You must call Initialize() before use."); } UnsafeNativeMethods.gertboardAnalogWrite((Int32)channel, value); }
/// <summary> /// Reads an analog value from the ADC on the Gertboard. /// </summary> /// <returns> /// The analog value retrieved. /// </returns> /// <param name="channel"> /// The channel to read from. /// </param> /// <exception cref="InvalidOperationException"> /// Not yet initialized. Call <see cref="Initialize()"/> before use. /// </exception> public static Int32 AnalogRead(GertboardAdcChannels channel) { if (!_initialized) { throw new InvalidOperationException("You must call Initialize() before use."); } return UnsafeNativeMethods.gertboardAnalogRead((Int32)channel); }