Skip to main content

Class Mcp3201

MCP3002 Analog to Digital Converter (ADC)

Assembly: Mcp3xxx.dll​
View Source​
Declaration
public class Mcp3201 : Mcp3xxx, IAnalogInputController, IPinController, ISpiPeripheral, IDisposable

Inheritance: System.Object -> Meadow.Foundation.ICs.IOExpanders.Mcp3xxx

Implements:
Meadow.Hardware.IAnalogInputController, Meadow.Hardware.IPinController, Meadow.Hardware.ISpiPeripheral, System.IDisposable

Properties​

Pins​

The pins

View Source​
Declaration
public Mcp3201.PinDefinitions Pins { get; }

Methods​

IsInputTypeSupported(InputType)​

Is the input type supported on this MCP3xxx version

View Source​
Declaration
public override bool IsInputTypeSupported(Mcp3xxx.InputType inputType)
Returns​

System.Boolean: True if supported, false if not supported

Parameters​
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.Mcp3xxx.InputTypeinputTypeThe input type

CreateAnalogInputPort(int)​

Create an analog input port for a pin

View Source​
Declaration
public IAnalogInputPort CreateAnalogInputPort(int sampleCount = 64)
Returns​

Meadow.Hardware.IAnalogInputPort

Parameters​
TypeName
System.Int32sampleCount

CreateAnalogInputPort(int, TimeSpan, Voltage)​

Create an analog input port for a pin

View Source​
Declaration
public IAnalogInputPort CreateAnalogInputPort(int sampleCount, TimeSpan sampleInterval, Voltage voltageReference)
Returns​

Meadow.Hardware.IAnalogInputPort

Parameters​
TypeName
System.Int32sampleCount
System.TimeSpansampleInterval
Meadow.Units.VoltagevoltageReference

ReadInternal(int, InputType, int)​

Reads a value from the device

View Source​
Declaration
protected override int ReadInternal(int channel, Mcp3xxx.InputType inputType, int adcResolutionBits)
Returns​

System.Int32: A value corresponding to relative voltage level on specified device channel

Parameters​
TypeNameDescription
System.Int32channelChannel to read - for differential inputs this represents a channel pair (valid values: 0 - channelcount - 1 or 0 - channelcount / 2 - 1 with differential inputs)
Meadow.Foundation.ICs.IOExpanders.Mcp3xxx.InputTypeinputTypeThe type of input channel to read
System.Int32adcResolutionBitsThe number of bits in the returned value

Implements​

  • Meadow.Hardware.IAnalogInputController
  • Meadow.Hardware.IPinController
  • Meadow.Hardware.ISpiPeripheral
  • System.IDisposable