本站改版新增arduino频道
arduino ULN2003步进电机 正转反转
#includeStepperControl control(StepperControl::DefaultStepCount, 0,1,18,19);
void setup()
{
control.SetDirection(StepperControl::Forward); //Backward Forward
control.SetRotationSpeed(2);
control.SetStepType(StepperControl::FullStep);
}
void loop()
{
// NOTE: initial Step count is always based on FullStep. WaveDrive will
// need only half of the steps for a full rotation, you can just query
// the controller to get the right amount of steps for the specified rotation
control.SetDirection(StepperControl::Forward); //Backward Forward
control.SetRotationSpeed(10);
control.SetStepType(StepperControl::FullStep);
const uint32_t steps = control.GetStepsFromDegrees(100);
control.Step(steps);
control.SetDirection(control.GetInvertedDirection());
delay(5000);
control.SetDirection(StepperControl::Backward); //Backward Forward
control.SetRotationSpeed(10);
control.SetStepType(StepperControl::FullStep);
const uint32_t steps2 = control.GetStepsFromDegrees(100);
control.Step(steps2);
control.SetDirection(control.GetInvertedDirection());
delay(5000);
}
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0094430446624756 seconds