Next: Arduino Device Functions, Previous: Arduino SPI Functions, Up: Function Reference [Contents][Index]
Free resources of a device object.
dev - object to free
See also: device.
Create an i2c, spi or serial object to communicate on a connected arduino.
ar - connected arduino object
propname, propvalue - property name/value pair for values to pass to devices.
A property of ’i2caddress’, ’spichipselectpin’ or ’serial’ must be specified to denote the device type to create.
i2caddress - address to use for device on I2C bus.
pin - pin to use for device SPI chip select.
serialid - Serial port id to use
Additional properties can also be specified for the device object
Currently known input I2C properties values:
bus number (when arduino board supports multiple I2C buses) with value of 0 or 1.
Do not probe the existence of device on creation if set to 1 (default 0)
bit rate speed in Mbs - default 100000
Currently known input SPI properties values:
bit rate speed in Mbs
’msbfirst’ or ’lsbfirst’
SPI mode 0 - 3.
Currently known input Serial properties values:
baudrate value (default 9600)
number of databits (5,6,7,8) (default 8)
number of stopbits (1,2) (default 1)
parity of device (’odd’,’even’,’none’) (default ’none’)
dev - new created device object.
The object has the following public properties:
The parent (arduino) for this device
The interface type for this device ("SPI" or "I2C" or "Serial")
In addition, depending on type, the object will have these properties:
The object has the following public properties:
bus used for created object
I2C address set for object
the SCL pin of the device
the SDA pin of the device
bit rate for the i2c clock
The object has the following public properties:
mode used for created object
Bitrate set for object
Bitorder set for object
Pin used for chipselect
Pin used for mosi
Pin used for miso
Pin used for sckpin
The object has the following public properties:
serial port id
baudrate
number of databits (5,6,7,8)
number of stopbits (1,2)
parity of device (’odd’,’even’,’none’)
See also: arduino, i2cdev, spidev.
Display device object.
dev - device object to display
See also: device.
Flush the serial port buffers
dev - connected serial device opened using device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: arduino, device, read.
Read a specified number of bytes from a i2c or serial device object using optional precision for bytesize.
dev - connected i2c or serial device opened using device
numbytes - number of bytes to read.
precision - Optional precision for the output data read data. Currently known precision values are uint8 (default), int8, uint16, int16
data - data read from the device
See also: arduino, device.
subref for device
See also: device.
Write data to a I2C or serial device object using optional precision for the data byte used for the data.
dev - connected i2c or serial device opened using device
datain - data to write to device. Datasize should not exceed the constraints of the data type specified for the precision.
precision - Optional precision for the input write data. Currently known precision values are uint8 (default), int8, uint16, int16
See also: arduino, device, read.
Next: Arduino Device Functions, Previous: Arduino SPI Functions, Up: Function Reference [Contents][Index]