: arduinoioaddons.adafruit.motorshieldv2

Adafruit motor shield addon

See also: addon.

Properties

Parent - the parent arduino object.

Pins - the pins allocated the addon.

I2CAddress - the i2c address used for accessing this shield.

PWMFrequency - the set PWM frequency for this shield.

Methods

: obj = motorshieldv2(arObj)
: obj = motorshieldv2(arObj, propertyname, propertyvalue ....)

Constructor to create motorshieldv2 addon object

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are:

address

I2C address of the motor shield (default 0x60)

pwmfrequency

PWM Frequency to set on shield (default 1600)

Outputs

obj - created motorshieldv2 object

Example


a = arduino()
mtr = addon(a, "adafruit/motorshieldv2")

: s = servo(mObj, mtrnum)
: s = servo(mObj, mtrnum, propertyname, propertyvalue ...)

Create a servo object

Inputs

mObj - the motor shield object

mtrnum - The servo motor number, where 1 is servo on pin "d10" and 2 is a servo on pin "d9"

propertyname, propertyvalue - Optional property name/value pairs to pass to servo object.

Properties are the same as the base servo object.

Outputs

s - a servo object

Example


a = arduino()
ms = addon(a, "adafruit/motorshieldv2")
# get servo 1 (servo on pin D10)
s = ms.servo(1)

The function if the equivalent of calling the arduino.servo with the D9 or D10 pin has the input pin.

See also: servo.

: s = stepper(mObj, mtrnum, stepsperrev)
: s = stepper(mObj, mtrnum, stepsperrev, propertyname, propertyvalue ...)

Create a stepper motor object

Inputs

mObj - the motor shield object

mtrnum - The stepper motor number (1 or 2)

stepsperrev - Number of steps per revolution.

propertyname, propertyvalue - Optional property name/value pairs to pass to stepper object.

Outputs

s - a stepper object

: s = dcmotor(mObj, mtrnum)
: s = dcmotor(mObj, mtrnum, propertyname, propertyvalue ...)

Create a dcmotor motor object

Inputs

mObj - the motor shield object

mtrnum - The motor number (1 - 4)

propertyname, propertyvalue - Optional property name/value pairs to pass to motor object.

Outputs

s - a dcmotorv2 object

Package: arduino