Class Arduino
Represents an Arduino board communicating with the host computer using the Firmata protocol.
public sealed class Arduino : IDisposable
- Inheritance
-
Arduino
- Implements
- Inherited Members
Constructors
- Arduino(string)
Initializes a new instance of the Arduino class using the specified port name.
- Arduino(string, int)
Initializes a new instance of the Arduino class using the specified port name and baud rate.
Fields
- DefaultBaudRate
Represents the default serial baud rate used to communicate with the Arduino.
- DefaultSamplingInterval
Represents the default sampling interval for analog pins.
Properties
- MajorVersion
Gets the major version of the Firmata firmware reported by the board on initialization.
- MinorVersion
Gets the minor version of the Firmata firmware reported by the board on initialization.
Methods
- AnalogRead(int)
Returns the current value of the specified analog pin.
- AnalogWrite(int, int)
Writes an analog value as a PWM wave to the specified digital output pin.
- Close()
Closes the port connection, sets the IsOpen property to false and disposes of the internal SerialPort object.
- DigitalPortRead(int)
Reads the current state of all the digital pins in the specified port.
- DigitalPortWrite(int, byte)
Sets the state of all the digital output pins in the specified port simultaneously.
- DigitalRead(int)
Reads the current state of the specified digital input pin.
- DigitalWrite(int, bool)
Sets the state of the specified digital output pin.
- GetPortNumber(int)
Gets the digital port number for the specified pin.
- I2CConfig(params byte[])
Configures I2C settings such as delay time and power pins.
- I2CRequest(int, I2CRequestMode, params byte[])
Sends a request to the I2C device with the specified address.
- I2CWrite(int, params byte[])
Writes a data payload to the I2C device with the specified address.
- Open(CancellationToken)
Opens a new serial port connection to the Arduino board.
- PinMode(int, PinMode)
Sets the mode of an individual Arduino pin.
- ReportAnalog(int, bool)
Enables or disables reporting of analog pin values for the specified pin number.
- ReportDigital(int, bool)
Enables or disables reporting of digital pin changes for the specified digital port in the Arduino.
- SamplingInterval(int)
Sets the sampling rate for reporting analog and I2C data in the main firmware loop.
- SendSysex(byte, params byte[])
Sends the specified MIDI SysEx command using the specified arguments.
Events
- AnalogInputReceived
Occurs when the Arduino object receives a new analog input event.
- DigitalInputReceived
Occurs when the Arduino object receives a new digital input event.
- SysexReceived
Occurs when the Arduino object receives a new MIDI SysEx message.