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.

SCAM Class

Module: scam

The driver was tested with the Serial Camera. There is no protocol documentation currently available, so this module was developed based completely on the Seeed Studio* Arduino* sketch.
It is connected via a UART at 115,200 baud.
scam.jpg

Methods

SCAM

(
  • uart
  • camAddr
)
Number

Serial Camera constructor

Parameters:

  • uart Number

    Default UART to use (0 or 1)

  • camAddr Number

    3-bit address identifier of the camera; default is 0

Returns:

Number:

dataAvailable

(
  • millis
)
Boolean

Checks to see if there is data available for reading

Parameters:

  • millis Number

    Number of milliseconds to wait; 0 means no waiting.

Returns:

Boolean:

True if there is data available for reading

readData

(
  • buffer
  • len
)
Number

Reads any available data into a user-supplied buffer. Note: the call blocks until data is available to be read. Use dataAvailable() to determine whether there is data available beforehand, to avoid blocking.

Parameters:

  • buffer Uint8_t *

    Buffer to hold the data read

  • len Number

    Length of the buffer

Returns:

Number:

Number of bytes read

writeData

(
  • buffer
  • len
)
Number

Writes the data in the buffer to the device

Parameters:

  • buffer Uint8_t *

    Buffer to hold the data read

  • len Number

    Length of the buffer

Returns:

Number:

Number of bytes written

setupTty

(
  • baud
)
Boolean

Sets up proper tty I/O modes and the baud rate. For this device, the default baud rate is 9,600 (B9600).

Parameters:

  • baud Speed_t

    Desired baud rate

Returns:

Boolean:

True if successful

drainInput

()

Reads serial input and discards until no more characters are available

init

() Boolean

Initializes the camera

Returns:

Boolean:

preCapture

(
  • fmt
)
Boolean

Tells the camera to prepare for a capture

Parameters:

  • fmt PIC_FORMATS_T

    One of the PIC_FORMATS_T values

Returns:

Boolean:

doCapture

() Boolean

Starts the capture

Returns:

Boolean:

True if successful

storeImage

(
  • fname
)
Boolean

Stores the captured image in a file

Parameters:

  • fname String

    Name of the file to write

Returns:

Boolean:

True if successful

getImageSize

() Number

Returns the picture length. Note: this is only valid after doCapture() has run successfully.

Returns:

Number:

Image length

Properties

FORMAT_VGA

Enum PIC_FORMATS_T

FORMAT_CIF

Enum PIC_FORMATS_T

FORMAT_OCIF

Enum PIC_FORMATS_T