Arduino Toolkit - arduinosensor.MPC3002


: arduinosensor.MPC3002

MCP3002 ADC sensor

Methods

: obj = MPC3002(arObj, selectPin)
: obj = MPC3002(arObj, selectPin, propertyname, propertyvalue ....)

Constructor to create MPC3002 sensor

Inputs

arObj - the arduino parent object

selectPin - the SPI cs select pin

propertyname, propertyvalue - optional property name, value pairs.

Current properties are:

referenceVoltage

Reference voltage for scaling the ADC inputs (default 5.0)

Outputs

obj - created MCP3002 object

Example

 
 a = arduino()
 sensor = arduinosensor.MPC3002(a, "d10")
 
 
: voltage = readVoltage(dsObj, chan)

Read the voltage from a channel

Inputs

dsObj - the MPC3002 object

chan - the channel to read (0 or 1)

Outputs

voltage - read voltage.

Example

 
 a = arduino()
 s = arduinosensor.MPC3002(a, "d10")
 volts = readVoltage(s, 0)
 
 

See also: arduinosensor.MPC3002.