/// <summary> /// Reads the value from the specified analog pin. /// </summary> /// <param name="pin">Should be the analog pin number (A0-A5)</param> /// <returns> /// The numerator of a ratio of input voltage over /// reference voltage, which is represented as 2^analogReadResolution(x). /// </returns> public uint AnalogRead(uint pin) { return(ArduinoInterop.analogRead(pin)); }
/// <summary> /// Perform an analog write (PWM) operation. /// </summary> /// <param name="pin"> /// The Arduino GPIO pin on which to generate the pulse train. /// Pins 3, 5, 6, 7, 8, 9, 10, or 11 are valid. /// </param> /// <param name="value">The analong value, which translates to the /// duty cycle of the pulse train. Range: 0-2^analogWriteResolution(x) /// - 0 - 0% duty cycle (no pulses are generated, output is LOW) /// - 2^analogWriteResolution(x) - 100% duty cycle (pulse train is HIGH /// continuously) /// </param> public void AnalogWrite(uint pin, uint value) { ArduinoInterop.analogWrite(pin, value); }
/// <summary> /// Perform an analog write (PWM) operation. /// </summary> /// <param name="pin"> /// The Arduino GPIO pin on which to generate the pulse train. /// Pins 3, 5, 6, 7, 8, 9, 10, or 11 are valid. /// </param> /// <param name="value">The analong value, which translates to the /// duty cycle of the pulse train. Range: 0-2^analogWriteResolution(x) /// - 0 - 0% duty cycle (no pulses are generated, output is LOW) /// - 2^analogWriteResolution(x) - 100% duty cycle (pulse train is HIGH /// continuously) /// </param> public void AnalogWrite(ArduinoPin pin, uint value) { ArduinoInterop.analogWrite((uint)pin, value); }
/// <summary> /// Reads the value from the digital pin (IO0 - IO13). /// A0-A5 are mapped to 14-19 /// </summary> /// <param name="pin">Pin number.</param> /// <returns>1 for HIGH, 0 for LOW, or -1 for error</returns> public State DigitalRead(ArduinoPin pin) { return((State)ArduinoInterop.digitalRead((uint)pin)); }
/// <summary> /// Reads the value from the digital pin (IO0 - IO13). /// A0-A5 are mapped to 14-19 /// </summary> /// <param name="pin">Pin number.</param> /// <returns>1 for HIGH, 0 for LOW, or -1 for error</returns> public State DigitalRead(uint pin) { return((State)ArduinoInterop.digitalRead(pin)); }
/// <summary> /// Set the digital pin (IO0 - IO13) to the specified state. /// If the analog pins (A0-A5) are configured as digital IOs, /// also sets the state of these pins. /// A0-A5 are mapped to 14-19 /// </summary> /// <param name="pin">Pin number.</param> /// <param name="state">State to set.</param> public void DigitalWrite(ArduinoPin pin, State state) { ArduinoInterop.digitalWrite((uint)pin, (uint)state); }
/// <summary> /// Set the digital pin (IO0 - IO13) to the specified state. /// If the analog pins (A0-A5) are configured as digital IOs, /// also sets the state of these pins. /// A0-A5 are mapped to 14-19 /// </summary> /// <param name="pin">Pin number.</param> /// <param name="state">State to set.</param> public void DigitalWrite(uint pin, State state) { ArduinoInterop.digitalWrite(pin, (uint)state); }
/// <summary> /// Configures the specified pin to behave either as an input /// or an output (IO0 - IO13). A0-A5 are mapped to 14-19 /// </summary> /// <param name="pin">Pin number.</param> /// <param name="mode">Mode to use.</param> public void PinMode(uint pin, PinMode mode) { ArduinoInterop.pinMode(pin, (uint)mode); }