Arduino Toolkit - arduinoioaddons.adafruit.dcmotorv2
- : arduinoioaddons.adafruit.dcmotorv2
DC Motor class for dc motor control on the adafruit motor shield
See also: arduinoioaddons.adafruit.motorshieldv2.
Properties
Speed - The speed value set for the motor
Parent - The parent shield for object (read only)
MotorNumber - The motor number (read only) values 1-4
IsRunning - boolean for if the motor is started (read only)
Methods
- :
obj =
dcmotorv2(mObj,mnum)
- :
obj =
dcmotorv2(mObj,mnum, propertyname, propertyvalue ....)
Constructor to create dcmotor object
Inputs
mObj - the motor shield object
mnum - The motor number (1 - 4)
propertyname, propertyvalue - Optional property name/value pairs to pass to motor object.
Current known properties are:
- Speed
Initial speed (default 0). Should be a value between -1 and 1.
Outputs
s - a dcmotorv2 object
Example
a = arduino() ms = addon(a, "adafruit/motorshieldv2") mtr = dcmotor(ms, 1)
- : start(dcObj)
Start the motor moving in previously set speed/direction
Inputs
dcObj - the dcmotor object
Outputs
None
See also: adafruit.motorshieldv2.
- : stop(dcObj)
Stop the motor moving
Inputs
dcObj - the dcmotor object
Outputs
None
See also: adafruit.motorshieldv2.