• 注册
  • 查看作者
  • ESP8266如何驱动步进电机

    简介:

    步进电 机可以通过ESP8266板载的GPIO口驱动,您可以使用Arduino的Stepper库将ESP8266控制步进电机。通过使用不同的驱动芯片,您还可以使用多路继电器和PWM信号驱动步进电机。

    ESP8266如何驱动步进电机

    esp8266驱动步进电机的代码

    /ESP8266 Stepper Motor Control Code/
    
    #include <Stepper.h>
    
    const int stepsPerRevolution = 200;
    
    // create an instance of the stepper class, specifying // the number of steps of the motor and the pins it's
    // connected to
    
    Stepper myStepper(stepsPerRevolution, 12, 13, 14, 15);
    
    void setup() { // set the speed of the motor to 30 RPMs myStepper.setSpeed(30); }
    
    void loop() { // step one revolution in one direction: myStepper.step(stepsPerRevolution);
    
    // step one revolution in the other direction: myStepper.step(-stepsPerRevolution); }

  • 0
  • 0
  • 0
  • 514
  • 请登录之后再进行评论

    登录
  • 动态
  • 单栏布局 侧栏位置: