UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

Gas Class

Module: gas

Methods

Gas

(
  • gasPin
)
Number

Instantiates a Gas object

Parameters:

  • gasPin Number

    Pin where gas is connected

Returns:

Number:

getSampledWindow

(
  • freqMS
  • numberOfSamples
  • buffer
)
Number

Gets samples from the gas sensor according to the provided window and number of samples

Parameters:

  • freqMS Number

    Time between each sample (in milliseconds)

  • numberOfSamples Number

    Number of sample to sample for this window

  • buffer Uint16_t *

    Buffer with sampled data

Returns:

Number:

findThreshold

(
  • ctx
  • threshold
  • buffer
  • len
)
Number

Given the sampled buffer, this method returns TRUE/FALSE if the threshold is reached

Parameters:

  • ctx ThresholdContext *

    Threshold context

  • threshold Number

    Sample threshold

  • buffer Uint16_t *

    Buffer with samples

  • len Number

    Buffer length

Returns:

Number:

getSampledData

(
  • ctx
)
Number

Returns average data for the sampled window

Parameters:

  • ctx ThresholdContext *

    Threshold context

Returns:

Number:

getSample

() Number

Returns one sample from the sensor

Returns:

Number:

printGraph

(
  • ctx
  • resolution
)

Prints a running average of the threshold context

Parameters:

  • ctx ThresholdContext *

    Threshold context

  • resolution Number

    undefined