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.
Package: arduino