开发工具 vscode + 插件 PlatformIO IDE
硬件 esp32 + ULN2003AN + 28BYJ-48
依赖库 Stepper
接线:
#define IN1 19
#define IN2 18
#define IN3 5
#define IN4 17
usb 供电的话 esp32 开发板 VIN 引脚可以输出5V 接到 ULN2003AN 模块的 5V 然后 负极共地
代码:
#include <Arduino.h>
#include <Stepper.h>
const int stepsPerRevolution = 2048; // change this to fit the number of steps per revolution
// ULN2003 Motor Driver Pins
#define IN1 19
#define IN2 1