mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 17:31:13 +03:00
grovemd: allow seperate directions for each DC motor
Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
d380658b40
commit
970d6a083f
@ -39,13 +39,13 @@ int main(int argc, char **argv)
|
||||
|
||||
// set direction to CW and set speed to 50%
|
||||
cout << "Spin M1 and M2 at half speed for 3 seconds" << endl;
|
||||
motors->setDirection(upm::GroveMD::DIR_CW);
|
||||
motors->setMotorDirections(upm::GroveMD::DIR_CW, upm::GroveMD::DIR_CW);
|
||||
motors->setMotorSpeeds(127, 127);
|
||||
|
||||
sleep(3);
|
||||
// counter clockwise
|
||||
cout << "Reversing M1 and M2 for 3 seconds" << endl;
|
||||
motors->setDirection(upm::GroveMD::DIR_CCW);
|
||||
motors->setMotorDirections(upm::GroveMD::DIR_CCW, upm::GroveMD::DIR_CCW);
|
||||
sleep(3);
|
||||
|
||||
//! [Interesting]
|
||||
|
@ -33,7 +33,8 @@ function start()
|
||||
{
|
||||
// set direction to CW and set speed to 50%
|
||||
console.log("Spin M1 and M2 at half speed for 3 seconds");
|
||||
my_MotorDriver_obj.setDirection(groveMotorDriver_lib.GroveMD.DIR_CW);
|
||||
my_MotorDriver_obj.setMotorDirections(groveMotorDriver_lib.GroveMD.DIR_CW,
|
||||
groveMotorDriver_lib.GroveMD.DIR_CW);
|
||||
my_MotorDriver_obj.setMotorSpeeds(127, 127);
|
||||
}
|
||||
}
|
||||
@ -44,7 +45,8 @@ function reverse()
|
||||
{
|
||||
// counter clockwise
|
||||
console.log("Reversing M1 and M2 for 3 seconds");
|
||||
my_MotorDriver_obj.setDirection(groveMotorDriver_lib.GroveMD.DIR_CCW);
|
||||
my_MotorDriver_obj.setMotorDirections(groveMotorDriver_lib.GroveMD.DIR_CCW,
|
||||
groveMotorDriver_lib.GroveMD.DIR_CCW);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user